package gui;
-import java.awt.BorderLayout;
-import java.awt.EventQueue;
-
-import domain.*;
-
-import javax.swing.JFrame;
-import javax.swing.JPanel;
-import javax.swing.border.EmptyBorder;
-import javax.swing.JLabel;
-
import java.awt.Font;
-
-import javax.swing.JTextField;
-import javax.swing.JScrollPane;
-
import java.awt.Rectangle;
-
-import javax.swing.JTable;
-import javax.swing.table.DefaultTableModel;
-
-import java.awt.Component;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.sql.Date;
+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.Box;
import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.border.EmptyBorder;
+import javax.swing.table.DefaultTableModel;
import businessLogic.AdminManager;
import businessLogic.HouseManager;
import businessLogic.HouseManagerInterface;
-
-import java.awt.event.ActionListener;
-import java.awt.event.ActionEvent;
+import domain.Administrator;
+import domain.RuralHouse;
public class listOfAdditionRequestsGUI extends JFrame {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
private JPanel contentPane;
private JTable table;
private DefaultTableModel tableModel;
* Create the frame.
*/
public listOfAdditionRequestsGUI() {
+ setTitle("Adding requests");
try {
this.houses= am.getAdditionRequests();
init();
lblNewLabel.setBounds(23, 41, 536, 33);
contentPane.add(lblNewLabel);
if (houses.isEmpty())
- lblNewLabel.setText("There are not houses matching your search");
+ lblNewLabel.setText("There are not houses to be added");
else
- lblNewLabel.setText("List of houses that match your search:");
+ lblNewLabel.setText("List of houses to be added:");
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(new Rectangle(45, 305, 320, 116));
scrollPane.setBounds(23, 113, 536, 271);
RuralHouse rh = houses.get(table.getSelectedRow());
//TODO when the house is not added show a warning to the user. Method below returns a boolean stating that.
hm.registerNewHouse(rh);
- houses.remove(rh);
am.removeHouseAdditionRequests(rh);
+ Administrator.saveInstance();
+ ((DefaultTableModel)table.getModel()).removeRow(houses.indexOf(rh));
+ houses.remove(rh);
}
}
});