The bug found in the presentation that we forgot to review has been fixed
[RRRRHHHH_Code] / ruralHouses / src / gui / ModifyHouseGUI.java
diff --git a/ruralHouses/src/gui/ModifyHouseGUI.java b/ruralHouses/src/gui/ModifyHouseGUI.java
deleted file mode 100644 (file)
index 29bc627..0000000
+++ /dev/null
@@ -1,248 +0,0 @@
-package gui;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-
-import javax.swing.GroupLayout;
-import javax.swing.GroupLayout.Alignment;
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-import javax.swing.LayoutStyle.ComponentPlacement;
-import javax.swing.SwingConstants;
-import javax.swing.border.EmptyBorder;
-
-import businessLogic.HouseManager;
-import domain.Owner;
-import domain.RuralHouse;
-
-public class ModifyHouseGUI extends JFrame {
-
-       /**
-        * 
-        */
-       private static final long serialVersionUID = 1L;
-       private JPanel contentPane;
-       private Owner owner;
-       private JLabel lblDistrict;
-       private JTextField District_f;
-       private JLabel lblDescription;
-       private JTextField description_f;
-       private JLabel lblKitchen;
-       private JTextField kitchens_f;
-       private JLabel lblRooms;
-       private JTextField rooms_f;
-       private JLabel lblLivings;
-       private JTextField lRooms_f;
-       private JLabel lblParkings;
-       private JTextField parkings_f;
-       private JLabel lblBaths;
-       private JTextField baths_f;
-       private JButton btnConfirm;
-       private JComboBox<RuralHouse> houseBox;
-       private RuralHouse rh;
-
-
-       /**
-        * Create the frame.
-        */
-       public ModifyHouseGUI(Owner o) {
-               this.getContentPane().setLayout(null);
-               owner = o;
-               setBounds(100, 100, 500, 583);
-               contentPane = new JPanel();
-               contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
-               setContentPane(contentPane);
-               
-               JLabel lblCode = new JLabel("House Name:");
-               lblCode.setHorizontalAlignment(SwingConstants.RIGHT);
-               
-               lblDistrict = new JLabel("District:");
-               lblDistrict.setHorizontalAlignment(SwingConstants.RIGHT);
-               
-               District_f = new JTextField();
-               District_f.setColumns(10);
-               
-               lblDescription = new JLabel("Description:");
-               lblDescription.setHorizontalAlignment(SwingConstants.RIGHT);
-               
-               description_f = new JTextField();
-               description_f.setColumns(10);
-               
-               lblKitchen = new JLabel("Kitchens:");
-               lblKitchen.setHorizontalAlignment(SwingConstants.RIGHT);
-               
-               kitchens_f = new JTextField();
-               kitchens_f.setColumns(10);
-               
-               lblRooms = new JLabel("Rooms:");
-               lblRooms.setHorizontalAlignment(SwingConstants.RIGHT);
-               
-               rooms_f = new JTextField();
-               rooms_f.setColumns(10);
-               
-               lblLivings = new JLabel("Living rooms:");
-               lblLivings.setHorizontalAlignment(SwingConstants.RIGHT);
-               
-               lRooms_f = new JTextField();
-               lRooms_f.setColumns(10);
-               
-               lblParkings = new JLabel("Parkings:");
-               lblParkings.setHorizontalAlignment(SwingConstants.RIGHT);
-               
-               parkings_f = new JTextField();
-               parkings_f.setColumns(10);
-               
-               lblBaths = new JLabel("Baths:");
-               lblBaths.setHorizontalAlignment(SwingConstants.RIGHT);
-               
-               baths_f = new JTextField();
-               baths_f.setColumns(10);
-               
-               btnConfirm = new JButton("Confirm");
-               btnConfirm.addActionListener(new ActionListener() {
-                       public void actionPerformed(ActionEvent arg0) {
-                               
-                               
-                               HouseManager hm = new HouseManager();
-                               hm.removeHouse(rh, owner);
-                               //TODO registernewhouse must check before if the house is created to delete it before creating it.
-                               hm.registerNewHouse(rh.getHouseName(),
-                                               owner,
-                                               description_f.getText(),
-                                               District_f.getText(),
-                                               new Integer(rooms_f.getText()),
-                                               new Integer(kitchens_f.getText()),
-                                               new Integer(baths_f.getText()),
-                                               new Integer(lRooms_f.getText()),
-                                               new Integer(parkings_f.getText())
-                               );
-                       }
-               });
-               
-               houseBox = new JComboBox<RuralHouse>(o.getRuralHouses());
-               
-               houseBox.addItemListener(new ItemListener() {
-            @Override
-            public void itemStateChanged(ItemEvent e) {
-                rh = (RuralHouse)houseBox.getSelectedItem();
-                District_f.setText(rh.getDistrict());
-                description_f.setText(rh.getDescription());
-                kitchens_f.setText(Integer.toString(rh.getFeatures().getnKitchens()));
-                rooms_f.setText(Integer.toString(rh.getFeatures().getnRooms()));
-                lRooms_f.setText(Integer.toString(rh.getFeatures().getnLivings()));
-                parkings_f.setText(Integer.toString(rh.getFeatures().getnParkings()));
-                baths_f.setText(Integer.toString(rh.getFeatures().getnBaths()));
-                
-            }
-        });
-               
-               GroupLayout gl_contentPane = new GroupLayout(contentPane);
-               gl_contentPane.setHorizontalGroup(
-                       gl_contentPane.createParallelGroup(Alignment.LEADING)
-                               .addGroup(gl_contentPane.createSequentialGroup()
-                                       .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
-                                               .addGroup(gl_contentPane.createSequentialGroup()
-                                                       .addContainerGap()
-                                                       .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
-                                                               .addGroup(gl_contentPane.createSequentialGroup()
-                                                                       .addComponent(lblParkings, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE)
-                                                                       .addGap(18)
-                                                                       .addComponent(parkings_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
-                                                               .addGroup(gl_contentPane.createSequentialGroup()
-                                                                       .addComponent(lblRooms, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE)
-                                                                       .addGap(18)
-                                                                       .addComponent(rooms_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
-                                                               .addGroup(gl_contentPane.createSequentialGroup()
-                                                                       .addComponent(lblCode)
-                                                                       .addPreferredGap(ComponentPlacement.UNRELATED)
-                                                                       .addComponent(houseBox, GroupLayout.PREFERRED_SIZE, 124, GroupLayout.PREFERRED_SIZE))
-                                                               .addGroup(gl_contentPane.createSequentialGroup()
-                                                                       .addComponent(lblBaths, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE)
-                                                                       .addGap(18)
-                                                                       .addComponent(baths_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
-                                                               .addGroup(gl_contentPane.createSequentialGroup()
-                                                                       .addComponent(lblDistrict, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE)
-                                                                       .addGap(18)
-                                                                       .addComponent(District_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
-                                                       .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
-                                                               .addGroup(gl_contentPane.createSequentialGroup()
-                                                                       .addGap(17)
-                                                                       .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
-                                                                               .addGroup(gl_contentPane.createSequentialGroup()
-                                                                                       .addComponent(lblLivings)
-                                                                                       .addGap(18)
-                                                                                       .addComponent(lRooms_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
-                                                                               .addGroup(gl_contentPane.createSequentialGroup()
-                                                                                       .addComponent(lblKitchen, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE)
-                                                                                       .addGap(18)
-                                                                                       .addComponent(kitchens_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))))
-                                                               .addGroup(gl_contentPane.createSequentialGroup()
-                                                                       .addGap(18)
-                                                                       .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
-                                                                               .addGroup(gl_contentPane.createSequentialGroup()
-                                                                                       .addGap(10)
-                                                                                       .addComponent(description_f, GroupLayout.PREFERRED_SIZE, 178, GroupLayout.PREFERRED_SIZE))
-                                                                               .addComponent(lblDescription, GroupLayout.PREFERRED_SIZE, 90, GroupLayout.PREFERRED_SIZE)))))
-                                               .addGroup(gl_contentPane.createSequentialGroup()
-                                                       .addGap(140)
-                                                       .addComponent(btnConfirm)))
-                                       .addContainerGap())
-               );
-               gl_contentPane.setVerticalGroup(
-                       gl_contentPane.createParallelGroup(Alignment.LEADING)
-                               .addGroup(gl_contentPane.createSequentialGroup()
-                                       .addGap(20)
-                                       .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
-                                               .addGroup(gl_contentPane.createSequentialGroup()
-                                                       .addGap(60)
-                                                       .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
-                                                               .addComponent(lblCode)
-                                                               .addComponent(houseBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
-                                                       .addPreferredGap(ComponentPlacement.UNRELATED)
-                                                       .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
-                                                               .addComponent(District_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
-                                                               .addComponent(lblDistrict)))
-                                               .addGroup(gl_contentPane.createSequentialGroup()
-                                                       .addGap(63)
-                                                       .addComponent(lblDescription)
-                                                       .addPreferredGap(ComponentPlacement.UNRELATED)
-                                                       .addComponent(description_f, GroupLayout.PREFERRED_SIZE, 129, GroupLayout.PREFERRED_SIZE)))
-                                       .addGap(71)
-                                       .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
-                                               .addGroup(gl_contentPane.createSequentialGroup()
-                                                       .addGap(3)
-                                                       .addComponent(lblRooms))
-                                               .addComponent(rooms_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
-                                               .addGroup(gl_contentPane.createSequentialGroup()
-                                                       .addGap(3)
-                                                       .addComponent(lblKitchen))
-                                               .addComponent(kitchens_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
-                                       .addGap(18)
-                                       .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
-                                               .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
-                                                       .addGroup(gl_contentPane.createSequentialGroup()
-                                                               .addGap(3)
-                                                               .addComponent(lblBaths))
-                                                       .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
-                                                               .addComponent(baths_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
-                                                               .addComponent(lblLivings)))
-                                               .addComponent(lRooms_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
-                                       .addGap(30)
-                                       .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
-                                               .addGroup(gl_contentPane.createSequentialGroup()
-                                                       .addGap(3)
-                                                       .addComponent(lblParkings))
-                                               .addComponent(parkings_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
-                                       .addGap(41)
-                                       .addComponent(btnConfirm)
-                                       .addGap(54))
-               );
-               contentPane.setLayout(gl_contentPane);
-       }
-}