Esempio n. 1
0
 public DefaultTableModel getClearTableModel() {
   DefaultTableModel model = new DefaultTableModel();
   model.addColumn("Start");
   model.addColumn("End");
   model.addColumn("Type");
   return model;
 }
 private void selFolder() {
   // selects a single folder, then makes table uneditable other than launch, sel res folder and
   // cancel, gui table different, just shows folder
   final JFileChooser fc = new JFileChooser(currentPath);
   fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
   int result = fc.showOpenDialog(FrontEnd.this);
   dir = fc.getSelectedFile();
   switch (result) {
     case JFileChooser.APPROVE_OPTION:
       dirImp = dir.toString();
       dtm.getDataVector().removeAllElements();
       dtm.fireTableDataChanged();
       curRow = 0;
       addRow();
       dtm.setValueAt(
           "You have chosen the folder '" + dirImp.substring(67) + "' and all of its subfolders.",
           0,
           0);
       dtm.setValueAt(dirImp.substring(67), 0, 1);
       if (table.getRowCount() > 0) {
         openF.setEnabled(false);
         openFo.setEnabled(false);
         selFo.setEnabled(false);
         canF.setEnabled(true);
       }
       selFoFl = 1;
     case JFileChooser.CANCEL_OPTION:
       break;
   }
 }
Esempio n. 3
0
 public void setTablaPrincipal(java.util.List val) {
   DefaultTableModel modelo = ((DefaultTableModel) this.tablaPrincipal.getModel());
   for (int i = 0; i < val.size(); i++) {
     modelo.addRow(((java.util.ArrayList) val.get(i)).toArray());
   }
   this.calculaSumas();
 }
 private void addRow() {
   if (table.getSelectedRow() != -1) {
     // inserts row below the selected one else bottom
     int numRow = table.getRowCount();
     dtm.insertRow(numRow + 1, ",".split(","));
   } else {
     dtm.addRow(",".split(","));
   }
 }
Esempio n. 5
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);
   }
 }
Esempio n. 6
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 cancelSel() {
   // resets launch changes.
   dtm.getDataVector().removeAllElements();
   dtm.fireTableDataChanged();
   openF.setEnabled(true);
   openFo.setEnabled(true);
   selFo.setEnabled(true);
   canF.setEnabled(false);
   selFoFl = 0;
   curRow = 0;
 }
Esempio n. 8
0
  public static void refreshCalendar(int month, int year) {
    // instantiation
    String[] months = {
      "January",
      "February",
      "March",
      "April",
      "May",
      "June",
      "July",
      "August",
      "September",
      "October",
      "November",
      "December"
    };
    int numoday, startom; // Number Of Days, Start Of Month

    // Allow/disallow buttons
    prev.setEnabled(true);
    next.setEnabled(true);
    if (month == 0 && year <= ryear) {
      prev.setEnabled(false);
    } // Cannot set an appointment back in time
    if (month == 11 && year >= ryear + 50) {
      next.setEnabled(false);
    } // Too early to set an appointment
    lmonth.setText(months[month]); // Refresh the month label (at the top)
    lmonth.setBounds(
        160 - lmonth.getPreferredSize().width / 2, 25, 180, 25); // Re-align label with calendar
    cyear.setSelectedItem(String.valueOf(year)); // Select the correct year in the combo box

    // deletes current table
    for (int i = 0; i < 6; i++) {
      for (int j = 0; j < 7; j++) {
        mcal.setValueAt(null, i, j);
      }
    }

    // Get first day of month and number of days
    GregorianCalendar cal = new GregorianCalendar(year, month, 1);
    numoday = cal.getActualMaximum(GregorianCalendar.DAY_OF_MONTH);
    startom = cal.get(GregorianCalendar.DAY_OF_WEEK);

    // Create calendar
    for (int i = 1; i <= numoday; i++) {
      int row = new Integer((i + startom - 2) / 7);
      int column = (i + startom - 2) % 7;
      mcal.setValueAt(i, row, column);
    }

    // Apply renderers
    Cal.setDefaultRenderer(Cal.getColumnClass(0), new tblCalendarRenderer());
  }
Esempio n. 9
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);
   }
 }
Esempio n. 10
0
  /**
   * Constructs a <code>VariabilityRecordTable</code> with a list of variability records.
   *
   * @param record_list the list of variability records.
   * @param desktop the parent desktop.
   */
  public VariabilityRecordTable(Vector record_list, net.aerith.misao.gui.Desktop desktop) {
    this.record_list = record_list;
    this.desktop = desktop;

    index = new ArrayIndex(record_list.size());

    model = new DefaultTableModel(column_names, 0);
    Object[] objects = new Object[column_names.length];
    objects[0] = new Boolean(true);
    for (int i = 1; i < column_names.length; i++) objects[i] = "";
    for (int i = 0; i < record_list.size(); i++) model.addRow(objects);
    setModel(model);

    column_model = (DefaultTableColumnModel) getColumnModel();
    for (int i = 1; i < column_names.length; i++)
      column_model
          .getColumn(i)
          .setCellRenderer(
              new StringRenderer(column_names[i], LabelTableCellRenderer.MODE_MULTIPLE_SELECTION));

    initializeCheckColumn();

    setTableHeader(new TableHeader(column_model));

    setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    initializeColumnWidth();

    pane = this;

    initPopupMenu();
  }
Esempio n. 11
0
  private Component table() {
    String[] titles = {
      "Year",
      "Starting Balance",
      "Starting Principal",
      "Withdrawals",
      "Appreciation",
      "Deposits",
      "Ending Balance"
    };
    tableModel = new DefaultTableModel(titles, 0);
    for (int i = 0; i < 12800; i++) {
      tableModel.addRow(
          new Integer[] {1900 + i, 10000 + i, 8000 + i, 50 + i, 905 + i, 2000 + i, 12000 + i});
    }

    JTable table = new CustomTable(tableModel);

    int preferredWidth = 0;
    for (int i = 0; i < table.getColumnCount(); i++) {
      int width = packColumn(table, i, 2);
      preferredWidth += width;
    }
    Dimension preferredSize = new Dimension(preferredWidth, 400);
    table.setPreferredScrollableViewportSize(preferredSize);
    this.setMinimumSize(preferredSize);

    JScrollPane scrollPane = new JScrollPane(table);
    return scrollPane;
  }
Esempio n. 12
0
    public void updateActionTableFor(EditorClient client) {

      if (client == null) {
        DefaultTableModel model = new DefaultTableModel();
        tblActions.setModel(getClearTableModel());
        return;
      } else if (currClient == client) {
        DefaultTableModel model = getClearTableModel();

        Iterator i = client.getActions(self).iterator();
        while (i.hasNext()) {
          EditorAction ea = (EditorAction) i.next();
          model.addRow(ea.getTableRow());
        }
        tblActions.setModel(model);
      }
    }
Esempio n. 13
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;
   }
 }
Esempio n. 15
0
 public CenterPanel(RegisterPanel rp) {
   super();
   setLayout(new BorderLayout());
   this.rp = rp;
   rp.setJT(jt);
   JScrollPane jsp = new JScrollPane(jt);
   setBackground(Color.BLACK);
   add(jsp, BorderLayout.CENTER);
   tm = (DefaultTableModel) jt.getModel();
   tm.addColumn("ID");
   tm.addColumn("Barcode");
   tm.addColumn("Name");
   tm.addColumn("Qty");
   tm.addColumn("Price");
   tm.addColumn("Tax");
   tm.addColumn("Total");
   // tm.setRowCount(50);
   // jt.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
   jt.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
   jt.getColumnModel().getColumn(0).setPreferredWidth(20);
   jt.getColumnModel().getColumn(1).setPreferredWidth(150);
   jt.getColumnModel().getColumn(2).setPreferredWidth(300);
   jt.getColumnModel().getColumn(3).setPreferredWidth(20);
   jt.setFont(new Font("Arial", Font.BOLD, 18));
   jt.setRowHeight(30);
 }
Esempio n. 16
0
 private void all() {
   try {
     for (Rooms rooms : RoomsController.roomsController.all()) {
       model.insertRow(0, rooms.toArray());
     }
   } catch (Exception ex) {
     ex.printStackTrace();
   }
 }
  private void backBind() {
    status.setText(viewModel.getStatus());
    compute.setEnabled(viewModel.isButtonEnabled());

    monthlyPayment.setText(viewModel.getMonthlyPayment());
    overpaymentWithFees.setText(viewModel.getOverpaymentWithFees());
    overpayment.setText(viewModel.getOverpayment());

    DefaultTableModel model = viewModel.getGraphicOfPayments();
    graphicOfPayments.setModel(model);
    graphicOfPayments.setPreferredSize(
        new Dimension(
            graphicOfPayments.getWidth(), graphicOfPayments.getRowHeight() * model.getRowCount()));

    List<String> log = viewModel.getLog();
    String[] items = log.toArray(new String[log.size()]);
    logList.setListData(items);
  }
 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;
   }
 }
Esempio n. 19
0
 public void addBinding(Binding t) {
   Integer ft = t.getFocusType();
   String s =
       (ft == JComponent.WHEN_FOCUSED)
           ? "WHEN_FOCUSED"
           : (ft == JComponent.WHEN_IN_FOCUSED_WINDOW)
               ? "WHEN_IN_FOCUSED_WINDOW"
               : "WHEN_ANCESTOR_OF_FOCUSED_COMPONENT";
   Object[] obj = {s, t.getActionName(), t.getKeyDescription()};
   super.addRow(obj);
 }
Esempio n. 20
0
 @Override
 public void actionPerformed(ActionEvent e) {
   ID = (Integer) hashRoomType.get(boxRoomTypeID.getSelectedItem().toString());
   IDSTATUS = (Integer) hashRoomStatus.get(boxRoomStatusID.getSelectedItem().toString());
   if (e.getSource() == buttonInsert) {
     try {
       Rooms rooms = new Rooms(txtRoomNumber.getText(), txtDescription.getText(), ID, IDSTATUS);
       RoomsController.roomsController.save(rooms);
       int c = model.getRowCount();
       for (int i = c - 1; i >= 0; i--) {
         model.removeRow(i);
         jRoom.revalidate();
       }
       all();
       JOptionPane.showMessageDialog(this, "ok");
     } catch (Exception ex) {
       ex.printStackTrace();
     }
   }
   if (e.getSource() == buttonUpdate) {
     try {
       Rooms rooms = new Rooms(txtRoomNumber.getText(), txtDescription.getText(), ID, IDSTATUS);
       rooms.setRoomID(IDROOM);
       RoomsController.roomsController.update(rooms);
       int c = model.getRowCount();
       for (int i = c - 1; i >= 0; i--) {
         model.removeRow(i);
         jRoom.revalidate();
       }
       all();
       JOptionPane.showMessageDialog(this, "Update to succeed !");
     } catch (Exception ex) {
       ex.printStackTrace();
     }
   }
   if (e.getSource() == buttonDelete) {
     try {
       List<CheckIn> temp = CheckInController.checkInController.all();
       for (int i = 0; i < temp.size(); i++) {
         if (IDROOM == temp.get(i).getRoomID()) {
           this.error = 0;
         } else {
           this.error = 0;
           RoomsController.roomsController.delete(IDROOM);
           int c = model.getRowCount();
           for (int ii = c - 1; ii >= 0; ii--) {
             model.removeRow(ii);
             jRoom.revalidate();
           }
           all();
         }
       }
       JOptionPane.showMessageDialog(this, "Delete to succeed !");
     } catch (Exception ex) {
       JOptionPane.showMessageDialog(this, "can't delete row bcause check still !");
     }
   }
   if (e.getSource() == buttonRefresh) {}
 }
Esempio n. 21
0
    public void keyPressed(KeyEvent ke) {

      if (ke.getKeyCode() == ke.VK_TAB) {
        int x = ((JTable) ke.getSource()).getSelectedColumn();
        int y = ((JTable) ke.getSource()).getSelectedRow();
        int maxX = ((JTable) ke.getSource()).getColumnCount();
        int maxY = ((JTable) ke.getSource()).getRowCount();
        TableModel tm = ((JTable) ke.getSource()).getModel();
        if (x == maxX - 1 && y == maxY - 1) {
          ((DefaultTableModel) tm).addRow(new Object[maxX]);
        }
      }
    }
Esempio n. 22
0
  /**
   * Gets the list of selected records.
   *
   * @return the list of selected records.
   */
  public Variability[] getSelectedRecords() {
    ArrayList list = new ArrayList();

    int check_column = getCheckColumn();
    for (int i = 0; i < model.getRowCount(); i++) {
      if (((Boolean) getValueAt(i, check_column)).booleanValue()) {
        Variability record = (Variability) record_list.elementAt(index.get(i));
        list.add(record);
      }
    }

    Variability[] records = new Variability[list.size()];
    return (Variability[]) list.toArray(records);
  }
Esempio n. 23
0
  GroupableHeaderExample() {
    super("Groupable Header Example");

    DefaultTableModel dm = new DefaultTableModel();
    dm.setDataVector(
        new Object[][] {
          {"119", "foo", "bar", "ja", "ko", "zh"},
          {"911", "bar", "foo", "en", "fr", "pt"}
        },
        new Object[] {"SNo.", "1", "2", "Native", "2", "3"});

    JTable table =
        new JTable(dm) {
          protected JTableHeader createDefaultTableHeader() {
            return new GroupableTableHeader(columnModel);
          }
        };

    TableColumnModel cm = table.getColumnModel();
    ColumnGroup g_name = new ColumnGroup("Name");
    g_name.add(cm.getColumn(1));
    g_name.add(cm.getColumn(2));
    ColumnGroup g_lang = new ColumnGroup("Language");
    g_lang.add(cm.getColumn(3));
    ColumnGroup g_other = new ColumnGroup("Others");
    g_other.add(cm.getColumn(4));
    g_other.add(cm.getColumn(5));
    g_lang.add(g_other);

    GroupableTableHeader header = (GroupableTableHeader) table.getTableHeader();
    header.addColumnGroup(g_name);
    header.addColumnGroup(g_lang);
    JScrollPane scroll = new JScrollPane(table);
    getContentPane().add(scroll);
    setSize(400, 120);
  }
Esempio n. 24
0
 public void setValueAt(Object obj, int row, int col) {
   if (obj instanceof Education)
     super.setValueAt(new Education((Education) obj, EmployeeAttribute.CODE), row, col);
   else if (obj instanceof JobTitle)
     super.setValueAt(new JobTitle((JobTitle) obj, EmployeeAttribute.DESCRIPTION), row, col);
   else if (obj instanceof Organization)
     super.setValueAt(
         new Organization((Organization) obj, EmployeeAttribute.DESCRIPTION), row, col);
   else if (obj instanceof Unit)
     super.setValueAt(new Unit((Unit) obj, Unit.CODE_DESCRIPTION), row, col);
   else if (obj instanceof WorkAgreement)
     super.setValueAt(
         new WorkAgreement((WorkAgreement) obj, EmployeeAttribute.DESCRIPTION), row, col);
   else if (obj instanceof SexType)
     super.setValueAt(new SexType((SexType) obj, EmployeeAttribute.DESCRIPTION), row, col);
   else if (obj instanceof Qualification)
     super.setValueAt(new Qualification((Qualification) obj, EmployeeAttribute.CODE), row, col);
   else super.setValueAt(obj, row, col);
 }
Esempio n. 25
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();
   }
 }
Esempio n. 26
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);
     }
   }
 }
Esempio n. 27
0
 @Override
 public void roleadd(EventAll<Rooms> event) {
   model.insertRow(0, event.getSource().toArray());
 }
 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 {
   }
 }
Esempio n. 29
0
  public static void main(String args[]) {
    // style that is necessary
    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (ClassNotFoundException e) {
    } catch (InstantiationException e) {
    } catch (IllegalAccessException e) {
    } catch (UnsupportedLookAndFeelException e) {
    }

    // Standard preparation for a frame
    fmain = new JFrame("Schedule Appointments"); // Create and name frame
    fmain.setSize(330, 375); // Set size to 400x400 pixels
    pane = fmain.getContentPane();
    pane.setLayout(null); // Apply null layout
    fmain.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Close when X is clicked

    // controls and portions of Calendar
    lmonth = new JLabel("January");
    lyear = new JLabel("Change year:");
    cyear = new JComboBox();
    prev = new JButton("<<");
    next = new JButton(">>");
    canc = new JButton("Cancel");
    mcal =
        new DefaultTableModel() {
          public boolean isCellEditable(int rowIndex, int mColIndex) {
            return false;
          }
        };
    Cal = new JTable(mcal);
    scal = new JScrollPane(Cal);
    pcal = new JPanel(null);

    canc.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            System.exit(0);
          }
        });

    // action listeners for buttons and the like
    prev.addActionListener(new btnPrev_Action());
    next.addActionListener(new btnNext_Action());
    cyear.addActionListener(new cmbYear_Action());
    Cal.addMouseListener(new mouseCont());

    // Adding the elements to the pane
    pane.add(pcal);
    pcal.add(lmonth);
    pcal.add(cyear);
    pcal.add(prev);
    pcal.add(next);
    pcal.add(canc);
    pcal.add(scal);

    // Setting where the elements are on the pane
    pcal.setBounds(0, 0, 320, 335);
    lmonth.setBounds(160 - lmonth.getPreferredSize().width / 2, 25, 100, 25);
    canc.setBounds(10, 305, 80, 20);
    cyear.setBounds(215, 305, 100, 20);
    prev.setBounds(10, 25, 50, 25);
    next.setBounds(260, 25, 50, 25);
    scal.setBounds(10, 50, 300, 250);

    // Make frame visible
    fmain.setResizable(false);
    fmain.setVisible(true);

    // Inner workings for the day mechanism
    GregorianCalendar cal = new GregorianCalendar(); // Create calendar
    rday = cal.get(GregorianCalendar.DAY_OF_MONTH); // Get day
    rmonth = cal.get(GregorianCalendar.MONTH); // Get month
    ryear = cal.get(GregorianCalendar.YEAR); // Get year
    currentMonth = rmonth; // Match month and year
    currentYear = ryear;

    // Add days
    String[] days = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; // All of the days
    for (int i = 0; i < 7; i++) {
      mcal.addColumn(days[i]);
    }

    Cal.getParent().setBackground(Cal.getBackground()); // Set background

    // No resize/reorder
    Cal.getTableHeader().setResizingAllowed(false);
    Cal.getTableHeader().setReorderingAllowed(false);

    // Single cell selection
    Cal.setColumnSelectionAllowed(true);
    Cal.setRowSelectionAllowed(true);
    Cal.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    // Set row/column count
    Cal.setRowHeight(38);
    mcal.setColumnCount(7);
    mcal.setRowCount(6);

    // Placing the dates in the cells
    for (int i = ryear - 100; i <= ryear + 100; i++) {
      cyear.addItem(String.valueOf(i));
    }

    // Refresh calendar
    refreshCalendar(rmonth, ryear); // Refresh calendar
  }
  public ItensVendidos() {
    super("Itens Vendidos");
    JButton imprimir;

    final DefaultTableModel modelo = new DefaultTableModel();

    // constrói a tabela
    JTable tabela = new JTable(modelo);

    // Cria duas colunas
    modelo.addColumn("Código");
    modelo.addColumn("Vendedor");
    modelo.addColumn("Produto");
    modelo.addColumn("Quantidade");

    imprimir = new JButton("Imprimir");
    imprimir.setBounds(100, 450, 30, 24);

    // exibe os dados da tabela MySQL
    // Conexao banco = new Conexao();
    String retorno = "erro";
    try {
      // Connection ExConn = (Connection) banco.abrirBDconn();
      Class.forName("com.mysql.jdbc.Driver");
      Connection conexao = DriverManager.getConnection("jdbc:mysql://localhost/banco", "root", "");
      Statement stmt = conexao.createStatement();

      // procedimentos para obter os dados de uma tabela

      String query = "SELECT * FROM venda2";
      ResultSet rs = stmt.executeQuery(query);

      while (rs.next()) {
        int id = rs.getInt("idVendedor");
        String nome = rs.getString("nomeVendedor");
        String produto = rs.getString("produto");
        int qtd = rs.getInt("qtd");
        modelo.addRow(new Object[] {new Integer(id), nome, produto, new Integer(qtd)});
      }

      // fim procedimento para obter os dados
    } catch (SQLException ex) {
      System.out.println("SQLException: " + ex.getMessage());
      System.out.println("SQLState: " + ex.getSQLState());
      System.out.println("VendorError: " + ex.getErrorCode());
    } catch (Exception e) {
      System.out.println("Problemas ao tentar conectar com o banco de dados");
    }
    // fim MySQL

    tabela.setPreferredScrollableViewportSize(new Dimension(350, 50));

    Container c = getContentPane();
    c.setLayout(new FlowLayout());

    JScrollPane scrollPane = new JScrollPane(tabela);
    c.add(scrollPane);
    c.add(imprimir);

    setSize(400, 300);
    setVisible(true);
  }