cleaning
[RRRRHHHH_Code] / ruralHouses / src / gui / AddOffersGUI.java
index 12d501b..e8b3df6 100644 (file)
@@ -8,6 +8,7 @@ import java.awt.event.FocusEvent;
 import java.awt.event.FocusListener;
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
+import java.rmi.Naming;
 import java.sql.Date;
 import java.text.DateFormat;
 import java.util.Calendar;
@@ -20,11 +21,10 @@ import javax.swing.JFrame;
 import javax.swing.JLabel;
 import javax.swing.JTextField;
 
-import businessLogic.OfferManager;
-
 import com.toedter.calendar.JCalendar;
+import common.OfferInterface;
 
-import domain.Offer;
+import configuration.___IntNames;
 import domain.RuralHouse;
 import exceptions.BadDates;
 import exceptions.OverlappingOfferExists;
@@ -35,7 +35,7 @@ public class AddOffersGUI extends JFrame  {
 private static final long serialVersionUID = 1L;
 
        
-  private JComboBox jComboBox1;
+  private JComboBox<RuralHouse> jComboBox1;
   private JLabel jLabel1 = new JLabel();
   private JLabel jLabel2 = new JLabel();
   private JTextField jTextField1 = new JTextField();
@@ -74,7 +74,7 @@ private static final long serialVersionUID = 1L;
     this.setTitle("Set availability");
     
     
-    jComboBox1 = new JComboBox(v);
+    jComboBox1 = new JComboBox<RuralHouse>(v);
     jComboBox1.setBounds(new Rectangle(115, 30, 115, 20));
     jLabel1.setText("List of houses:");
     jLabel1.setBounds(new Rectangle(25, 30, 95, 20));
@@ -208,8 +208,15 @@ private static final long serialVersionUID = 1L;
                        float price= Float.parseFloat(jTextField3.getText());
 
                        //Obtain the business logic from a StartWindow class (local or remote)
-                       OfferManager offerM = new OfferManager();
-
+                       OfferInterface offerM = null;
+                       try {
+                               offerM = (OfferInterface) Naming
+                                               .lookup(___IntNames.OfferManager);
+                       } catch (Exception e1) {
+                               System.out.println("Error accessing remote authentication: "
+                                               + e1.toString());
+                       }
+                       
                        offerM.createOffer(ruralHouse, firstDay, lastDay, price); 
 
                        jLabel5.setText("Offer created");