From: pinene Date: Sun, 19 Apr 2015 14:18:02 +0000 (+0200) Subject: Merge branch 'master' of https://xp-dev.com/git/RRRRHHHH_Code X-Git-Url: https://xp-dev.com/git/RRRRHHHH_Code/commitdiff_plain/42679bcd0e79750f8a1ec7c2388cd4d675de58f1 Merge branch 'master' of https://xp-dev.com/git/RRRRHHHH_Code Conflicts: ruralHouses/src/businessLogic/OfferManager.java ruralHouses/src/gui/HouseFeaturesGUI.java ruralHouses/src/gui/ModifyHouseGUI.java ruralHouses/src/gui/StartWindow.java --- 42679bcd0e79750f8a1ec7c2388cd4d675de58f1 diff --cc ruralHouses/src/businessLogic/OfferManager.java index 955d64e,a0cd67e..8c6fb3e --- a/ruralHouses/src/businessLogic/OfferManager.java +++ b/ruralHouses/src/businessLogic/OfferManager.java @@@ -22,6 -26,31 +22,7 @@@ public final class OfferManager } } - public static int getNumber() { - ObjectContainer db=DB4oManager.getContainer(); - OfferManager o=getInstance(); - o.offerNumber++; - db.store(o); - db.commit(); - return o.offerNumber; - } + - /** - * This method returns the instance of the OfferManager class - * - * @return the offer manager - */ - public static OfferManager getInstance() { - ObjectContainer db=DB4oManager.getContainer(); - OfferManager b = new OfferManager(); - ObjectSet result = db.queryByExample(b); - if (!result.hasNext()){ - theOfferManager = new OfferManager(); - db.store(theOfferManager); - db.commit(); - } else theOfferManager=(OfferManager)result.next(); - return theOfferManager; - } /** * This method creates an offer with a house number, first day, last day and price diff --cc ruralHouses/src/gui/HouseFeaturesGUI.java index f5258cb,95ddb3a..a8643e4 --- a/ruralHouses/src/gui/HouseFeaturesGUI.java +++ b/ruralHouses/src/gui/HouseFeaturesGUI.java @@@ -52,8 -53,8 +52,9 @@@ public class HouseFeaturesGUI extends J private RuralHouse rh; private JTextField telIn; private int row; - private JLabel phoneNum; + private JLabel labelPhone; + + /** * Create the frame. */ @@@ -195,10 -196,10 +196,11 @@@ telIn.setBounds(99, 505, 129, 20); contentPane.add(telIn); telIn.setColumns(10); -- - phoneNum = new JLabel(""); - phoneNum.setBounds(215, 255, 201, 15); - contentPane.add(phoneNum); ++ + labelPhone = new JLabel(""); + labelPhone.setBounds(238, 252, 178, 14); + contentPane.add(labelPhone); ++ table.addMouseListener( new MouseAdapter(){ @Override public void mouseClicked(MouseEvent arg0) { @@@ -249,21 -250,24 +251,23 @@@ private void jButton_ActionPerformed(ActionEvent arg0) { BookingManager bookingM = new BookingManager(); //RegExp to see if telephone number is correct??TODO - if (!telIn.getText().matches("[976]\\d{2}[.\\- ]?\\d{3}[.\\- ]?\\d{3}")){ - phoneNum.setText("Wrong phone format"); - }else { - phoneNum.setText(""); - - Booking book = null; - try { - if (table.getRowCount()!=0) - book = bookingM.createBooking(rh, rh.offers.get(row).getFirstDay(), rh.offers.get(row).getLastDay(), telIn.getText()); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - if (book != null) { - BookRuralHouseConfirmationWindow confirmWindow = new BookRuralHouseConfirmationWindow( - book); - confirmWindow.setVisible(true); - } + if (telIn.getText().matches("[976]\\d{2}[.\\- ]?\\d{3}[.\\- ]?\\d{3}")) { + Booking book = null; + try { + if (table.getRowCount()!=0) + book = bookingM.createBooking(rh, rh.offers.get(row).getFirstDay(), rh.offers.get(row).getLastDay(), telIn.getText()); + } catch (Exception e) { + e.printStackTrace(); + } + if (book != null) { + BookRuralHouseConfirmationWindow confirmWindow = new BookRuralHouseConfirmationWindow( + book); + confirmWindow.setVisible(true); + } + } else { + labelPhone.setText("Phone format is wrong"); ++ ++ } } } diff --cc ruralHouses/src/gui/ModifyHouseGUI.java index 6d980d1,d902074..6b64b19 --- a/ruralHouses/src/gui/ModifyHouseGUI.java +++ b/ruralHouses/src/gui/ModifyHouseGUI.java @@@ -52,9 -52,9 +52,10 @@@ public class ModifyHouseGUI extends JFr /** * Create the frame. */ - public ModifyHouseGUI(Owner o) { + public ModifyHouseGUI(final Owner o) { this.distric=Districs.longNames(); - comboBox = new JComboBox(new DefaultComboBoxModel( + comboBox = new JComboBox(new DefaultComboBoxModel( ++ this.distric)); this.getContentPane().setLayout(null); owner = o; diff --cc ruralHouses/src/gui/StartWindow.java index 600233b,663369b..385d09b --- a/ruralHouses/src/gui/StartWindow.java +++ b/ruralHouses/src/gui/StartWindow.java @@@ -48,7 -47,8 +48,7 @@@ public class StartWindow extends JFram UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); c=configuration.ConfigXML.getInstance(); - + - }catch (com.db4o.ext.DatabaseFileLockedException e) { a.lblNewLabel.setText("Database locked: Do not run BusinessLogicServer or BusinessLogicServer!!"); a.lblNewLabel.setForeground(Color.RED);