deleted aplicationFacade and imported it's functions to specific business logics.
[RRRRHHHH_Code] / ruralHouses / src / gui / SetAvailability2GUI.java
index 86a1d29..9b40bbb 100644 (file)
@@ -9,7 +9,8 @@ import javax.swing.*;
 import java.awt.*;
 import java.awt.event.*;
 
-import businessLogic.ApplicationFacadeInterface;
+
+import businessLogic.OfferManager;
 
 import com.toedter.calendar.JCalendar;
 
@@ -22,6 +23,7 @@ import exceptions.BadDates;
 
 public class SetAvailability2GUI extends JFrame  {
 private static final long serialVersionUID = 1L;
+
        
   private JComboBox jComboBox1;
   private JLabel jLabel1 = new JLabel();
@@ -195,14 +197,12 @@ private static final long serialVersionUID = 1L;
                        float price= Float.parseFloat(jTextField3.getText());
 
                        //Obtain the business logic from a StartWindow class (local or remote)
-                       ApplicationFacadeInterface facade=StartWindow.getBusinessLogic();
+                       OfferManager offerM = new OfferManager();
 
-                       Offer o = facade.createOffer(ruralHouse, firstDay, lastDay, price); 
+                       Offer o = offerM.createOffer(ruralHouse, firstDay, lastDay, price); 
                        System.out.println("Offer created: "+o.toString());
 
-                       if (o==null)
-                               jLabel5.setText("Bad dates or there exists an overlapping offer");
-                       else jLabel5.setText("Offer created");
+                       jLabel5.setText("Offer created");
 
                } catch (java.lang.NumberFormatException e1) {
                        jLabel5.setText(jTextField3.getText()+ " is not a valid price");
@@ -211,10 +211,12 @@ private static final long serialVersionUID = 1L;
                }
                catch (BadDates e1) {
                        jLabel5.setText("Last day is before first day in the offer");
+               } catch (NullPointerException e1){
+                       jLabel5.setText("Bad dates or there exists an overlapping offer");
                } catch (Exception e1) {
-
+               
                        e1.printStackTrace();
-               }
+               } 
   }
   private void jButton2_actionPerformed(ActionEvent e)
   {