import java.awt.*;
import java.awt.event.*;
-import businessLogic.ApplicationFacadeInterface;
+
+import businessLogic.OfferManager;
import com.toedter.calendar.JCalendar;
public class SetAvailability2GUI extends JFrame {
private static final long serialVersionUID = 1L;
+
private JComboBox jComboBox1;
private JLabel jLabel1 = new JLabel();
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");
}
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)
{