Git Repository Public Repository

RRRRHHHH_Code

URLs

Copy to Clipboard

Diff Revisions 7bf57b ... vs 6a5d4d ... for ruralHouses/src/gui/listOfBookingRequestsGUI.java

Diff revisions: vs.
  @@ -5,7 +5,6 @@
5 5 import java.awt.event.ActionEvent;
6 6 import java.awt.event.ActionListener;
7 7 import java.util.Enumeration;
8 - import java.util.LinkedList;
9 8 import java.util.Vector;
10 9
11 10 import javax.swing.JButton;
  @@ -20,8 +19,6 @@
20 19 import businessLogic.BookingManager;
21 20 import domain.Booking;
22 21 import domain.Offer;
23 - import domain.Owner;
24 - import domain.RuralHouse;
25 22
26 23 public class listOfBookingRequestsGUI extends JFrame {
27 24
  @@ -51,7 +48,7 @@
51 48 }
52 49
53 50 private void init() throws Exception {
54 - setBounds(100, 100, 600, 450);
51 + setBounds(100, 100, 600, 500);
55 52 contentPane = new JPanel();
56 53 contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
57 54 setContentPane(contentPane);
  @@ -81,8 +78,7 @@
81 78 };
82 79 scrollPane.setViewportView(table);
83 80 tableModel = new DefaultTableModel(null, new String[] {
84 - "Booking Number", "Is paid", "Booking Date", "Telephone",
85 - "Offer" });
81 + "Booking Number", "Is paid", "Booking Date","Name","E-mail", "Telephone" });
86 82
87 83 // Maybe there is a better way to avoid interaction.
88 84 // table.setEnabled(false);
  @@ -92,23 +88,36 @@
92 88 btnNewButton.addActionListener(new ActionListener() {
93 89 public void actionPerformed(ActionEvent e) {
94 90 if (table.getRowCount() != 0 && table.getSelectedRow() != -1) {
95 -
91 + if (table.getRowCount() != 0 && table.getSelectedRow() != -1) {
92 + Booking book = bookings.get(table.getSelectedRow());
93 + bookM.acceptBooking(book);
94 + }
96 95 }
97 96 }
98 97 });
99 - btnNewButton.setBounds(88, 396, 169, 25);
98 + btnNewButton.setBounds(33, 396, 169, 25);
100 99 contentPane.add(btnNewButton);
101 100
102 101 JButton btnDenyAddition = new JButton("Deny Booking");
103 102 btnDenyAddition.addActionListener(new ActionListener() {
104 103 public void actionPerformed(ActionEvent arg0) {
105 104 if (table.getRowCount() != 0 && table.getSelectedRow() != -1) {
106 -
105 + Booking book = bookings.get(table.getSelectedRow());
106 + bookM.removeDenyBooking(book);
107 107 }
108 108 }
109 109 });
110 - btnDenyAddition.setBounds(300, 396, 169, 25);
110 + btnDenyAddition.setBounds(390, 395, 169, 25);
111 111 contentPane.add(btnDenyAddition);
112 +
113 + JButton btnSetAsPaid = new JButton("Set as paid");
114 + btnSetAsPaid.setBounds(239, 395, 89, 23);
115 + btnSetAsPaid.addActionListener(new ActionListener() {
116 + public void actionPerformed(ActionEvent arg0) {
117 +
118 + }
119 + });
120 + contentPane.add(btnSetAsPaid);
112 121 Enumeration<Booking> en = this.bookings.elements();
113 122 Booking book;
114 123 while (en.hasMoreElements()) {
  @@ -117,8 +126,9 @@
117 126 row.add(book.getBookNumber());
118 127 row.add(book.isPaid());
119 128 row.add(book.getBookDate());
120 - row.add(book.getClient());
121 - row.add(book.getOffer());
129 + row.add(book.getClient().getName());
130 + row.add(book.getClient().getMailAccount());
131 + row.add(book.getClient().getTelephone());
122 132 tableModel.addRow(row);
123 133 }
124 134