Booking confirmation and e-mail service added. Some bugs to be solved.
[RRRRHHHH_Code] / ruralHouses / src / gui / listOfBookingRequestsGUI.java
index 2a70df5..831cc3c 100644 (file)
@@ -5,7 +5,6 @@ import java.awt.Rectangle;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.util.Enumeration;
-import java.util.LinkedList;
 import java.util.Vector;
 
 import javax.swing.JButton;
@@ -20,8 +19,6 @@ import javax.swing.table.DefaultTableModel;
 import businessLogic.BookingManager;
 import domain.Booking;
 import domain.Offer;
-import domain.Owner;
-import domain.RuralHouse;
 
 public class listOfBookingRequestsGUI extends JFrame {
 
@@ -51,7 +48,7 @@ public class listOfBookingRequestsGUI extends JFrame {
        }
 
        private void init() throws Exception {
-               setBounds(100, 100, 600, 450);
+               setBounds(100, 100, 600, 500);
                contentPane = new JPanel();
                contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
                setContentPane(contentPane);
@@ -81,8 +78,7 @@ public class listOfBookingRequestsGUI extends JFrame {
                };
                scrollPane.setViewportView(table);
                tableModel = new DefaultTableModel(null, new String[] {
-                               "Booking Number", "Is paid", "Booking Date", "Telephone",
-                               "Offer" });
+                               "Booking Number", "Is paid", "Booking Date","Name","E-mail", "Telephone" });
 
                // Maybe there is a better way to avoid interaction.
                // table.setEnabled(false);
@@ -92,23 +88,36 @@ public class listOfBookingRequestsGUI extends JFrame {
                btnNewButton.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                                if (table.getRowCount() != 0 && table.getSelectedRow() != -1) {
-
+                                       if (table.getRowCount() != 0 && table.getSelectedRow() != -1) {
+                                               Booking book = bookings.get(table.getSelectedRow());
+                                               bookM.acceptBooking(book);
+                                       }
                                }
                        }
                });
-               btnNewButton.setBounds(88, 396, 169, 25);
+               btnNewButton.setBounds(33, 396, 169, 25);
                contentPane.add(btnNewButton);
 
                JButton btnDenyAddition = new JButton("Deny Booking");
                btnDenyAddition.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent arg0) {
                                if (table.getRowCount() != 0 && table.getSelectedRow() != -1) {
-
+                                       Booking book = bookings.get(table.getSelectedRow());
+                                       bookM.removeDenyBooking(book);
                                }
                        }
                });
-               btnDenyAddition.setBounds(300, 396, 169, 25);
+               btnDenyAddition.setBounds(390, 395, 169, 25);
                contentPane.add(btnDenyAddition);
+               
+               JButton btnSetAsPaid = new JButton("Set as paid");
+               btnSetAsPaid.setBounds(239, 395, 89, 23);
+               btnSetAsPaid.addActionListener(new ActionListener() {
+                       public void actionPerformed(ActionEvent arg0) {
+                               
+                       }
+               });
+               contentPane.add(btnSetAsPaid);
                Enumeration<Booking> en = this.bookings.elements();
                Booking book;
                while (en.hasMoreElements()) {
@@ -117,8 +126,9 @@ public class listOfBookingRequestsGUI extends JFrame {
                        row.add(book.getBookNumber());
                        row.add(book.isPaid());
                        row.add(book.getBookDate());
-                       row.add(book.getClient());
-                       row.add(book.getOffer());
+                       row.add(book.getClient().getName());
+                       row.add(book.getClient().getMailAccount());
+                       row.add(book.getClient().getTelephone());
                        tableModel.addRow(row);
                }