コード例 #1
0
ファイル: BorrowerPanel.java プロジェクト: fafeitsch/Loft
 private void deleteBorrowerPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_deleteBorrowerPerformed
   if (borrowersTable.getSelectedRowCount() > 0) {
     try {
       Borrower b =
           reader.getBorrower((Integer) model.getValueAt(borrowersTable.getSelectedRow(), 0));
       int result =
           JOptionPane.showConfirmDialog(
               this,
               java.util.ResourceBundle.getBundle("de/web/feitsch/fabian/loft/bundles/bundle")
                       .getString("gui.delete_question")
                   + b.getName()
                   + " "
                   + b.getSurname()
                   + "'?",
               java.util.ResourceBundle.getBundle("de/web/feitsch/fabian/loft/bundles/bundle")
                   .getString("gui.msgtitles.warning"),
               JOptionPane.YES_NO_OPTION);
       if (result == JOptionPane.YES_OPTION) {
         BorrowerBookQuest relationQuest = new BorrowerBookQuest();
         relationQuest.addNumericCondition(
             "borrower_id", b.getID(), DigitOperator.EQUAL, SQLOperator.AND);
         ArrayList<BorrowerBookRelation> relations =
             reader.getBorrowerBookRelations(relationQuest);
         for (BorrowerBookRelation relation : relations) {
           writer.deleteEntry(relation);
         }
         writer.deleteEntry(b);
         repaint();
       }
     } catch (SQLException ex) {
       Logger.getLogger(BorrowerPanel.class.getName()).log(Level.SEVERE, null, ex);
     }
   }
 } // GEN-LAST:event_deleteBorrowerPerformed
コード例 #2
0
ファイル: BorrowerPanel.java プロジェクト: fafeitsch/Loft
 /** Creates new form BorrowerPanel */
 public BorrowerPanel(DataBaseReader reader, DataBaseWriter writer) {
   this.writer = writer;
   this.reader = reader;
   initComponents();
   quest = new BorrowerQuest();
   model = (BorrowerDataModel) borrowersTable.getModel();
   model.showBorrowers(quest);
 }
コード例 #3
0
ファイル: BorrowerPanel.java プロジェクト: fafeitsch/Loft
 @Override
 public void repaint() {
   if (model != null) {
     model.showBorrowers(quest);
     counterLabel.setText(String.valueOf(borrowersTable.getRowCount()));
     borrowersTable.repaint();
   }
   super.repaint();
 }
コード例 #4
0
ファイル: BorrowerPanel.java プロジェクト: fafeitsch/Loft
 private void editBorrowerPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_editBorrowerPerformed
   if (borrowersTable.getSelectedRowCount() > 0) {
     try {
       Borrower b =
           reader.getBorrower((Integer) model.getValueAt(borrowersTable.getSelectedRow(), 0));
       BorrowerInputDialog inputDialog =
           new BorrowerInputDialog(
               java.util.ResourceBundle.getBundle("de/web/feitsch/fabian/loft/bundles/bundle")
                   .getString("gui.borrower.edit_a_borrower"),
               writer,
               b);
       inputDialog.setLocationRelativeTo(this);
       inputDialog.setVisible(true);
       repaint();
     } catch (SQLException ex) {
       Logger.getLogger(BorrowerPanel.class.getName()).log(Level.SEVERE, null, ex);
     }
   }
 } // GEN-LAST:event_editBorrowerPerformed