DeleteOffers and Modify Offers completed, both logic and GUI
[RRRRHHHH_Code] / ruralHouses / src / gui / DeleteOfferGUI.java
index 463919e..d58ab58 100644 (file)
@@ -24,15 +24,20 @@ import businessLogic.OfferManager;
 import domain.Offer;
 import domain.Owner;
 import domain.RuralHouse;
+
 import javax.swing.JLabel;
 import javax.swing.LayoutStyle.ComponentPlacement;
 
 public class DeleteOfferGUI extends JFrame {
 
+       /**
+        * 
+        */
+       private static final long serialVersionUID = 1L;
        private JPanel contentPane;
        private Owner owner;
-       private JComboBox comboBox;
-       private JComboBox comboBox_1;
+       private JComboBox<RuralHouse> comboBox;
+       private JComboBox<Offer> comboBox_1;
        private JButton btnDelete;
 
 
@@ -46,17 +51,31 @@ public class DeleteOfferGUI extends JFrame {
                contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
                setContentPane(contentPane);
        
-               comboBox = new JComboBox(this.owner.getRuralHouses());
+               comboBox = new JComboBox<RuralHouse>(this.owner.getRuralHouses());
                
                
                
-               comboBox_1 = new JComboBox(((RuralHouse)comboBox.getSelectedItem()).offers);
+               comboBox_1 = new JComboBox<Offer>();
 
                JRadioButton rdbtnIAmSure = new JRadioButton("I am sure");
                
                btnDelete = new JButton("DELETE");
                btnDelete.setEnabled(false);
                
+               comboBox.addItemListener(new ItemListener() {
+
+                       @Override
+                       public void itemStateChanged(ItemEvent arg0) {
+                               Vector<Offer> vo = ((RuralHouse)comboBox.getSelectedItem()).offers;
+                               comboBox_1.removeAllItems();
+                               for (Offer of: vo){
+                                       comboBox_1.addItem(of);;
+                               }
+               
+                       }
+                       
+               });
+               
                rdbtnIAmSure.addItemListener(new ItemListener() {
 
                        @Override