Merge branch 'master' of https://xp-dev.com/git/RRRRHHHH_Code
[RRRRHHHH_Code] / ruralHouses / src / gui / listOfAdditionRequestsGUI.java
index dd728fe..0fbf336 100644 (file)
@@ -24,6 +24,10 @@ import domain.RuralHouse;
 
 public class listOfAdditionRequestsGUI extends JFrame {
 
+       /**
+        * 
+        */
+       private static final long serialVersionUID = 1L;
        private JPanel contentPane;
        private JTable table;
        private DefaultTableModel tableModel;
@@ -33,6 +37,7 @@ public class listOfAdditionRequestsGUI extends JFrame {
         * Create the frame.
         */
        public listOfAdditionRequestsGUI() {
+               setTitle("Adding requests");
                try {
                        this.houses= am.getAdditionRequests();
                        init();
@@ -53,9 +58,9 @@ public class listOfAdditionRequestsGUI extends JFrame {
                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);
@@ -85,9 +90,10 @@ public class listOfAdditionRequestsGUI extends JFrame {
                                        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);
                                }
                        }
                });