implemented lacking GUIs and corrected errors
authorpinene <epinzolas001@ikasle.ehu.eus>
Fri, 6 Mar 2015 09:41:12 +0000 (10:41 +0100)
committerpinene <epinzolas001@ikasle.ehu.eus>
Fri, 6 Mar 2015 09:41:12 +0000 (10:41 +0100)
15 files changed:
1  2 
ruralHouses/db/DBjcampos004.yap
ruralHouses/src/businessLogic/FacadeImplementation.java
ruralHouses/src/businessLogic/HouseManager.java
ruralHouses/src/businessLogic/HouseManagerInterface.java
ruralHouses/src/businessLogic/LoginManager.java
ruralHouses/src/dataAccess/DB4oManager.java
ruralHouses/src/domain/Owner.java
ruralHouses/src/domain/RuralHouse.java
ruralHouses/src/gui/DeleteHouseGUI.java
ruralHouses/src/gui/HousesRelatedOwnerGUI.java
ruralHouses/src/gui/LoginGUI.java
ruralHouses/src/gui/ModifyHouseGUI.java
ruralHouses/src/gui/NewHouseGUI.java
ruralHouses/src/gui/OwnerMenuGUI.java
ruralHouses/src/gui/StartWindow.java

index 41236b6,0000000..212f8cd
mode 100644,000000..100644
Binary files differ
@@@ -2,23 -2,19 +2,19 @@@ package businessLogic
  
  import java.rmi.RemoteException;
  import java.rmi.server.UnicastRemoteObject;
  import java.util.Date;
  import java.util.Vector;
  import java.sql.SQLException;
  
  import com.db4o.ObjectContainer;
  import com.db4o.ObjectSet;
- import configuration.Config;
  
+ import configuration.Config;
  import dataAccess.DB4oManager;
  import domain.Booking;
  import domain.Offer;
  import domain.Owner;
  import domain.RuralHouse;
  import exceptions.OfferCanNotBeBooked;
  
  public class FacadeImplementation extends UnicastRemoteObject implements ApplicationFacadeInterface {
                dbMngr = DB4oManager.getInstance();
        }
  
-       /**
-        * This method obtains an owner's rural houses 
-        * 
-        * @param owner object
-        *            
-        * @return a vector of Rural Houses
-        */
-       public Vector<RuralHouse> getRuralHouses(Owner owner)
-                       throws RemoteException {
-               return owner.getRuralHouses();          
-       }
  
        public Offer createOffer(RuralHouse ruralHouse, Date firstDay, Date lastDay,
                        float price) throws RemoteException, Exception {                 
                return dbMngr.getOwners();
        } 
  
+       /**
+        * This method obtains an owner's rural houses 
+        * 
+        * @param owner object
+        *            
+        * @return a vector of Rural Houses
+        */
+       public Vector<RuralHouse> getRuralHouses(Owner owner)
+                       throws RemoteException {
+               return owner.getRuralHouses();          
+       }
        public Vector<RuralHouse> getAllRuralHouses() throws RemoteException,
        Exception {             
                return dbMngr.getAllRuralHouses();              
        }
 +
        
  
        public Booking createBooking(RuralHouse ruralHouse, Date firstDate, Date lastDate, String bookTelephoneNumber)
index 0000000,21b8925..82eedfc
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,72 +1,62 @@@
 -                      // TODO Auto-generated catch block
+ package businessLogic;
+ import java.rmi.RemoteException;
+ import java.util.Date;
+ import java.util.Vector;
+ import dataAccess.DB4oManager;
+ import domain.Account;
+ import domain.HouseFeatures;
+ import domain.Offer;
+ import domain.Owner;
+ import domain.RuralHouse;
+ public class HouseManager implements HouseManagerInterface {
+       DB4oManager dbMngr;
+       public HouseManager() {
+               try {
+                       dbMngr = DB4oManager.getInstance();
+               } catch (Exception e) {
 -      @Override
 -      public boolean registerNewHouse(int houseNumber, Owner owner, String town,
 -                      int nRooms, int nKitchens, int nBaths, int nLivings, int nParkings) {
 -              // TODO Auto-generated method stub
 -              boolean stored = false;
 -              if (nKitchens < 1 || nLivings < 3 || nBaths < 2)
 -                      return false;
 -              HouseFeatures feature = new HouseFeatures(nRooms, nKitchens, nBaths,
 -                              nLivings, nParkings);
 -              stored = this.dbMngr.storeRuralHouses(new RuralHouse(houseNumber,
 -                              owner, town, feature));
 -              return stored;
++
+                       e.printStackTrace();
+               }
+       }
 -      }
 -              // TODO Auto-generated method stub
+       @Override
+       public boolean registerNewHouse(int houseNumber, Owner owner,
+                       String description, String town, int nRooms, int nKitchens,
+                       int nBaths, int nLivings, int nParkings) {
 -              stored = this.dbMngr.storeRuralHouses(new RuralHouse(houseNumber,
 -                              owner, description, town, feature));
+               boolean stored = false;
+               if (nKitchens < 1 || nLivings < 3 || nBaths < 2)
+                       return false;
+               HouseFeatures feature = new HouseFeatures(nRooms, nKitchens, nBaths,
+                               nLivings, nParkings);
++              RuralHouse rh = new RuralHouse(houseNumber,
++                              owner, description, town, feature);
++              owner.getRuralHouses().add(rh);
++              stored = this.dbMngr.storeRuralHouses(rh);
+               return stored;
+       }
++      
++      
+       public void removeHouse(int houseNumber) {
+               this.dbMngr.removeHouse(houseNumber);
+       }
+       // For future implementation
+       // @Override
+       // public void modifyHouse(int houseNumber, Owner owner, String description,
+       // String town, int nRooms, int nKitchens, int nBaths, int nLivings,
+       // int nParkings) {
+       // // TODO Auto-generated method stub
+       //
+       // }
+       // Maybe returning the offer is not necessary. Depends on GUI
+       // implementation.
+ }
index 0000000,7a0656f..65e2baa
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,28 +1,27 @@@
 -      public boolean registerNewHouse(int houseNumber, Owner owner, String town,
 -                      int nRooms, int nKitchens, int nBaths, int nLivings, int nParkings);
+ package businessLogic;
+ import java.rmi.RemoteException;
+ import java.util.Date;
+ import java.util.Vector;
+ import domain.Offer;
+ import domain.Owner;
+ import domain.RuralHouse;
+ public interface HouseManagerInterface {
++
+       public boolean registerNewHouse(int houseNumber, Owner owner,
+                       String description, String town, int nRooms, int nKitchens,
+                       int nBaths, int nLivings, int nParkings);
+       // For future implementation
+       // public void modifyHouse(int houseNumber, Owner owner,
+       // String description, String town, int nRooms, int nKitchens,
+       // int nBaths, int nLivings, int nParkings);
+       public void removeHouse(int houseNumber);
+ }
@@@ -1,8 -1,5 +1,6 @@@
  package businessLogic;
  
 +
  import java.util.Vector;
  
  import dataAccess.DB4oManager;
@@@ -10,12 -7,11 +8,11 @@@ import domain.Account
  import domain.Owner;
  
  public class LoginManager implements LoginManagerInterface {
-       //owners to be separated to accounts later on
        DB4oManager dbMngr;
-       
-       
        public LoginManager() {
-               
                try {
                        dbMngr = DB4oManager.getInstance();
                } catch (Exception e) {
                }
        }
  
        @Override
        public Owner checkCredentials(String usr, String pwd) {
                try {
                        Vector<Account> account = dbMngr.getAccount(usr, pwd);
-                       if(account.isEmpty()) return null;
-                       else return account.get(0).getOwner();
-                       
+                       if (account.isEmpty())
+                               return null;
+                       else
+                               return account.get(0).getOwner();
                } catch (Exception e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }
                return null;
        }
-       
-       
-        
  }
@@@ -7,7 -7,6 +7,6 @@@ import java.util.Vector
  //import java.util.Enumeration;
  //import java.util.Vector;
  
  import businessLogic.BookingManager;
  
  import com.db4o.*;
@@@ -16,105 -15,148 +15,153 @@@ import configuration.Config
  import domain.*;
  import exceptions.OfferCanNotBeBooked;
  
- public class DB4oManager { 
+ public class DB4oManager {
  
        private static ObjectContainer db;
-       private static DB4oManager theDB4oManager=new DB4oManager();
+       private static DB4oManager theDB4oManager = new DB4oManager();
  
+       /**
+        * 
+        */
        private DB4oManager() {
-               Config c=Config.getInstance();
-               String dataBaseOpenMode=c.getDataBaseOpenMode();
+               Config c = Config.getInstance();
+               String dataBaseOpenMode = c.getDataBaseOpenMode();
                DB4oManager.openDatabase(dataBaseOpenMode);
        }
  
+       /**
+        * @param mode
+        */
        public static void openDatabase(String mode) {
-               Config c=Config.getInstance();
-               String db4oFileName=c.getDb4oFilename();
-               if (mode.compareTo("open")==0) {
-                       db=Db4o.openFile(Db4o.newConfiguration(), db4oFileName);
+               Config c = Config.getInstance();
+               String db4oFileName = c.getDb4oFilename();
+               if (mode.compareTo("open") == 0) {
+                       db = Db4o.openFile(Db4o.newConfiguration(), db4oFileName);
                        db.ext().configure().updateDepth(5);
  
-               } else if (mode.compareTo("initialize")==0){
++
+               } else if (mode.compareTo("initialize") == 0) {
                        try {
-                       new File(db4oFileName).delete();
-                       db=Db4o.openFile(Db4o.newConfiguration(), db4oFileName);
-                       db.ext().configure().updateDepth(5);
-                       Owner jon = new Owner("Jon");
-                       Owner alfredo = new Owner("Alfredo");
-                       jon.addRuralHouse(1, "Ezkioko etxea","Ezkio");
-                       jon.addRuralHouse(2, "Eskiatzeko etxea","Jaca");
-                       jon.setBankAccount("1349 5677 21 2133567777");
-                       alfredo.addRuralHouse(3, "Casa del abuelo","Pitillas");
-                       alfredo.addRuralHouse(4, "Refugio","Murgia");
-                       alfredo.setBankAccount("4144 0087 23 9700002133");
-                       Account jonAcc = new Account("userJon", "passJon",jon);
-                       Account alfredoAcc = new Account("userAlfredo", "passAlfredo",alfredo);
-                       db.store(jon);
-                       db.store(alfredo);
-                       db.store(jonAcc);
-                       db.store(alfredoAcc);
-                       db.commit();
-                       System.out.println("DataBase Initialized");
+                               new File(db4oFileName).delete();
+                               db = Db4o.openFile(Db4o.newConfiguration(), db4oFileName);
+                               db.ext().configure().updateDepth(5);
+                               Owner jon = new Owner("Jon");
+                               Owner alfredo = new Owner("Alfredo");
+                               jon.addRuralHouse(1, "Ezkioko etxea", "Ezkio", 3, 3, 3, 3, 3);
+                               jon.addRuralHouse(2, "Eskiatzeko etxea", "Jaca", 4, 4, 4, 4, 4);
+                               jon.setBankAccount("1349 5677 21 2133567777");
+                               alfredo.addRuralHouse(3, "Casa del abuelo", "Pitillas", 5, 5,
+                                               5, 5, 5);
 -                              alfredo.addRuralHouse(4, "Murgia", 6, 6, 6, 6, 6);
++                              alfredo.addRuralHouse(4,"", "Murgia", 6, 6, 6, 6, 6);
+                               alfredo.setBankAccount("4144 0087 23 9700002133");
+                               Account jonAcc = new Account("userJon", "passJon", jon);
+                               Account alfredoAcc = new Account("userAlfredo", "passAlfredo",
+                                               alfredo);
+                               db.store(jon);
+                               db.store(alfredo);
+                               db.store(jonAcc);
+                               db.store(alfredoAcc);
+                               db.commit();
+                               System.out.println("DataBase Initialized");
                        } finally {
-                       db.close();
+                               db.close();
                        }
-                       
                }
        }
  
-       public  static ObjectContainer getContainer() {
+       /**
+        * @return
+        */
+       public static ObjectContainer getContainer() {
                return db;
        }
-       
-       
++
+       /**
+        * @param rh
+        */
+       public boolean storeRuralHouses(RuralHouse rh) {
+               DB4oManager.openDatabase("open");
+               boolean stored = false;
+               ObjectContainer db = DB4oManager.getContainer();
+               RuralHouse house = new RuralHouse(rh.getHouseNumber(), null, null,
+                               null, null);
+               try {
+                       ObjectSet<Owner> result = db.queryByExample(house);
+                       if (result.isEmpty()) {
+                               db.store(rh);
+                               db.commit();
+                               stored = true;
+                       }
+               } finally {
+                       db.close();
+               }
+               return stored;
+       }
        /**
-        * This method finds all existing  owners 
+        * This method finds all existing owners
         * 
         */
-       public Vector<Owner> getOwners() throws RemoteException,
-       Exception {
++
+       public Vector<Owner> getOwners() throws RemoteException, Exception {
                DB4oManager.openDatabase("open");
-               ObjectContainer db=DB4oManager.getContainer();
+               ObjectContainer db = DB4oManager.getContainer();
  
                try {
-                       Owner proto = new Owner(null,null);
+                       Owner proto = new Owner(null, null);
                        ObjectSet<Owner> result = db.queryByExample(proto);
-                       Vector<Owner> owners=new Vector<Owner>();
-                       while(result.hasNext())                          
-                               owners.add((Owner)result.next());
+                       Vector<Owner> owners = new Vector<Owner>();
+                       while (result.hasNext())
+                               owners.add((Owner) result.next());
                        return owners;
                } finally {
                        db.close();
                }
-       } 
-       
-       public Vector<Account> getAccount(String usr, String pwd) throws RemoteException,
-       Exception {
++
+       }
+       /**
+        * @param usr
+        * @param pwd
+        * @return
+        * @throws RemoteException
+        * @throws Exception
+        */
+       public Vector<Account> getAccount(String usr, String pwd)
+                       throws RemoteException, Exception {
                DB4oManager.openDatabase("open");
-               ObjectContainer db=DB4oManager.getContainer();
+               ObjectContainer db = DB4oManager.getContainer();
  
                try {
-                       Account proto = new Account(usr,pwd, new Owner(null,null));
+                       Account proto = new Account(usr, pwd, new Owner(null, null));
                        ObjectSet<Account> result = db.queryByExample(proto);
-                       Vector<Account> accounts=new Vector<Account>();
-                       while(result.hasNext())                          
-                               accounts.add((Account)result.next());
+                       Vector<Account> accounts = new Vector<Account>();
+                       while (result.hasNext())
+                               accounts.add((Account) result.next());
                        return accounts;
                } finally {
                        db.close();
                }
        }
-       
+       /**
+        * @return
+        * @throws RemoteException
+        * @throws Exception
+        */
        public Vector<RuralHouse> getAllRuralHouses() throws RemoteException,
-       Exception {
++
+                       Exception {
                DB4oManager.openDatabase("open");
-               ObjectContainer db=DB4oManager.getContainer();
+               ObjectContainer db = DB4oManager.getContainer();
                try {
-                       RuralHouse proto = new RuralHouse(0,null,null,null);
+                       RuralHouse proto = new RuralHouse(0, null, null, null, null);
                        ObjectSet<RuralHouse> result = db.queryByExample(proto);
-                       Vector<RuralHouse> ruralHouses=new Vector<RuralHouse>();
-                       while(result.hasNext()) 
-                               ruralHouses.add((RuralHouse)result.next());
+                       Vector<RuralHouse> ruralHouses = new Vector<RuralHouse>();
+                       while (result.hasNext())
+                               ruralHouses.add((RuralHouse) result.next());
                        return ruralHouses;
                } finally {
                        db.close();
        }
  
        /**
-        * This method creates an offer with a house number, first day, last day and price
-        * precondition: There are no overlapping offers
+        * This method creates an offer with a house number, first day, last day and
+        * price precondition: There are no overlapping offers
+        * 
         * @param House
         *            number, start day, last day and price
         * @return None
         */
-       public Offer createOffer(RuralHouse ruralHouse, Date firstDay, Date lastDay,
-                       float price) throws RemoteException, Exception {
++
+       public Offer createOffer(RuralHouse ruralHouse, Date firstDay,
+                       Date lastDay, float price) throws RemoteException, Exception {
                DB4oManager.openDatabase("open");
-               ObjectContainer db=DB4oManager.getContainer();
+               ObjectContainer db = DB4oManager.getContainer();
                Offer o;
                try {
-               RuralHouse proto = new RuralHouse(ruralHouse.getHouseNumber(), null, 
-                               ruralHouse.getDescription(), ruralHouse.getTown());
-               ObjectSet<RuralHouse> result = db.queryByExample(proto);
-               RuralHouse rh=(RuralHouse)result.next();
-               o=rh.createOffer(firstDay, lastDay, price);
-               db.store(o);
-               db.commit(); 
-               }
-               finally{
-               db.close();
+                       RuralHouse proto = new RuralHouse(ruralHouse.getHouseNumber(),
+                                       null, ruralHouse.getDescription(), ruralHouse.getTown(),
+                                       ruralHouse.getFeatures());
+                       ObjectSet<RuralHouse> result = db.queryByExample(proto);
+                       RuralHouse rh = (RuralHouse) result.next();
+                       o = rh.createOffer(firstDay, lastDay, price);
+                       db.store(o);
+                       db.commit();
+               } finally {
+                       db.close();
                }
                return o;
        }
  
-       public RuralHouse getRuralHouse(RuralHouse rh){
-               
++
+       /**
+        * @param rh
+        * @return
+        */
+       public RuralHouse getRuralHouse(RuralHouse rh) {
                DB4oManager.openDatabase("open");
                try {
-                       ObjectContainer db=DB4oManager.getContainer();
+                       ObjectContainer db = DB4oManager.getContainer();
                        RuralHouse proto = new RuralHouse(rh.getHouseNumber(), null,
-                                       rh.getDescription(), rh.getTown());
++
+                                       rh.getDescription(), rh.getTown(), rh.getFeatures());
                        ObjectSet<RuralHouse> result = db.queryByExample(proto);
-                       return  rh=(RuralHouse)result.next();
+                       return rh = (RuralHouse) result.next();
                } catch (Exception exc) {
                        exc.printStackTrace();
                        return null;
-               }
-               finally {
+               } finally {
                        db.close();
                }
 -      }
++
 +      } 
  
+       /**
+        * @param offer
+        * @param clientTelephoneNumber
+        * @return
+        * @throws OfferCanNotBeBooked
+        */
        public Booking createBooking(Offer offer, String clientTelephoneNumber)
                        throws OfferCanNotBeBooked {
                DB4oManager.openDatabase("open");
                try {
-                       Booking b=null;
-                       if (offer!=null) {
-                               b=offer.createBook(clientTelephoneNumber);
+                       Booking b = null;
+                       if (offer != null) {
+                               b = offer.createBook(clientTelephoneNumber);
                                db.store(b);
                                db.store(offer);
                                db.commit();
                } catch (Exception exc) {
                        exc.printStackTrace();
                        return null;
+               } finally {
+                       db.close();
                }
-               finally {
++
+       }
+       public void removeHouse(int houseNumber) {
+               ObjectContainer db = DB4oManager.getContainer();
+               RuralHouse house = new RuralHouse(houseNumber, null, null, null, null);
+               try {
+                       ObjectSet<RuralHouse> result = db.queryByExample(house);
+                       if (!result.isEmpty()) {
+                               RuralHouse found = (RuralHouse) result.get(0);
+                               db.delete(found);
+                               db.commit();
+                       }
+               } catch (Exception exc) {
+                       exc.printStackTrace();
+               } finally {
                        db.close();
                }
        }
  
        /**
-        * This method returns the instance of the DB4oManager class 
+        * This method returns the instance of the DB4oManager class
         * 
         * @return the db4o manager
         */
-       public static DB4oManager getInstance()  {
+       public static DB4oManager getInstance() {
                return theDB4oManager;
        }
  
  }
@@@ -7,18 -7,18 +7,18 @@@ import java.util.Vector
  public class Owner implements Serializable {
  
        private String bankAccount = "";
-       private String name="";
+       private String name = "";
        private Vector<RuralHouse> ruralHouses;
  
        public Owner(String name) {
-               this.name=name;
-               ruralHouses=new Vector<RuralHouse>();           
+               this.name = name;
+               ruralHouses = new Vector<RuralHouse>();
        }
  
        public Owner(String name, String bankAccount) {
-               this.bankAccount=bankAccount;
-               this.name=name;
-               ruralHouses=new Vector<RuralHouse>();           
+               this.bankAccount = bankAccount;
+               this.name = name;
+               ruralHouses = new Vector<RuralHouse>();
        }
  
        public String getName() {
                this.bankAccount = bankAccount;
        }
  
--      public Vector<RuralHouse> getRuralHouses() {
--              return ruralHouses;
++      public Vector<RuralHouse> getRuralHouses(){
++              return this.ruralHouses;
        }
  
-       public RuralHouse addRuralHouse(int houseNumber, String description, String city) {
-               RuralHouse rh=new RuralHouse(houseNumber,  this,  description,  city);
 -      public RuralHouse addRuralHouse(int houseNumber, String town, int nRooms,
 -                      int nKitchens, int nBaths, int nLivings, int nParkings) {
 -              HouseFeatures feature = new HouseFeatures(nRooms, nKitchens, nBaths, nLivings, nParkings);
 -              RuralHouse rh = new RuralHouse(houseNumber, this, town,feature);
 -              ruralHouses.add(rh);
 -              return rh;
 -      }
++
+       public RuralHouse addRuralHouse(int houseNumber, String description,
+                       String town, int nRooms, int nKitchens, int nBaths, int nLivings,
+                       int nParkings) {
+               HouseFeatures feature = new HouseFeatures(nRooms, nKitchens, nBaths, nLivings, nParkings);
+               RuralHouse rh = new RuralHouse(houseNumber, this, description, town,feature);
                ruralHouses.add(rh);
                return rh;
        }
-       
-       public String toString(){
+       public String toString() {
                return name;
        }
  
@@@ -13,19 -13,30 +13,23 @@@ public class RuralHouse implements Seri
        private String description;
        private Owner owner;
        private String town; 
+       private HouseFeatures features;
        public Vector<Offer> offers;
        
        public RuralHouse() {
                super();
        }
  
-       public RuralHouse(int houseNumber, Owner owner, String description, String town) {
+       public RuralHouse(int houseNumber, Owner owner, String description, String town ,HouseFeatures features) {
                this.houseNumber = houseNumber;
                this.description = description;
                this.owner = owner;
                this.town = town;
+               this.features = features;
                offers=new Vector<Offer>();
        }
 -      public RuralHouse(int houseNumber, Owner owner, String town , HouseFeatures features) {
 -              this.houseNumber = houseNumber;
 -              this.description = null;
 -              this.owner = owner;
 -              this.town = town;
 -              this.features = features;
 -              offers=new Vector<Offer>();
 -      }
+       
++      
  
        public int getHouseNumber() {
                return houseNumber;
        public void setTown(String town) {
                this.town=town;
        }
-       
+       public HouseFeatures getFeatures() {
+               return features;
+       }
+       public void setFeatures(HouseFeatures features) {
+               this.features = features;
+       }       
        public String toString() {
                return this.houseNumber + ": " + this.town;
        }
                return availableOffers;
        }
        
+       
        /**
         * This method obtains the offer that match exactly with a given dates that has not been booked
         * 
                }
                return null;            
        }
+       
+       
  
  }
index 0000000,0000000..0395a15
new file mode 100644 (file)
--- /dev/null
--- /dev/null
@@@ -1,0 -1,0 +1,91 @@@
++package gui;
++
++import java.awt.BorderLayout;
++import java.awt.EventQueue;
++import java.awt.event.ActionEvent;
++import java.awt.event.ActionListener;
++
++import javax.swing.JFrame;
++import javax.swing.JPanel;
++import javax.swing.border.EmptyBorder;
++import javax.swing.GroupLayout;
++import javax.swing.GroupLayout.Alignment;
++import javax.swing.JComboBox;
++import javax.swing.JRadioButton;
++import javax.swing.JButton;
++
++import businessLogic.FacadeImplementation;
++import businessLogic.HouseManager;
++
++import domain.Owner;
++import domain.RuralHouse;
++
++public class DeleteHouseGUI extends JFrame {
++
++      private JPanel contentPane;
++      private Owner owner;
++      private JComboBox comboBox;
++
++
++
++      /**
++       * Create the frame.
++       */
++      public DeleteHouseGUI(Owner o) {
++              o = owner;
++              setBounds(100, 100, 450, 300);
++              contentPane = new JPanel();
++              contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
++              setContentPane(contentPane);
++              
++              
++              
++              comboBox = new JComboBox();
++              
++              JRadioButton rdbtnIAmSure = new JRadioButton("I am sure");
++              
++              JButton btnDelete = new JButton("DELETE");
++              GroupLayout gl_contentPane = new GroupLayout(contentPane);
++              gl_contentPane.setHorizontalGroup(
++                      gl_contentPane.createParallelGroup(Alignment.LEADING)
++                              .addGroup(gl_contentPane.createSequentialGroup()
++                                      .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
++                                              .addGroup(gl_contentPane.createSequentialGroup()
++                                                      .addGap(70)
++                                                      .addComponent(comboBox, GroupLayout.PREFERRED_SIZE, 332, GroupLayout.PREFERRED_SIZE))
++                                              .addGroup(gl_contentPane.createSequentialGroup()
++                                                      .addGap(85)
++                                                      .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
++                                                              .addComponent(btnDelete)
++                                                              .addComponent(rdbtnIAmSure))))
++                                      .addContainerGap(954, Short.MAX_VALUE))
++              );
++              gl_contentPane.setVerticalGroup(
++                      gl_contentPane.createParallelGroup(Alignment.LEADING)
++                              .addGroup(gl_contentPane.createSequentialGroup()
++                                      .addGap(50)
++                                      .addComponent(comboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
++                                      .addGap(68)
++                                      .addComponent(rdbtnIAmSure)
++                                      .addGap(47)
++                                      .addComponent(btnDelete)
++                                      .addContainerGap(493, Short.MAX_VALUE))
++              );
++              contentPane.setLayout(gl_contentPane);
++              
++              btnDelete.addActionListener(new ActionListener() {
++                      public void actionPerformed(ActionEvent arg0) {
++                              actionListenerButton(arg0);
++                              
++                      }
++
++                      
++              });
++      }
++      
++      private void actionListenerButton(ActionEvent e){
++              RuralHouse toDel = (RuralHouse)comboBox.getSelectedItem();
++              HouseManager hm = new HouseManager();
++              hm.removeHouse(toDel.getHouseNumber());
++      }
++}
index 4a7bfba,0000000..656d76f
mode 100644,000000..100644
--- /dev/null
@@@ -1,97 -1,0 +1,95 @@@
-               setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 +package gui;
 +
 +import java.awt.BorderLayout;
 +import java.awt.EventQueue;
++import java.awt.Frame;
 +
 +import javax.swing.JFrame;
 +import javax.swing.JPanel;
 +import javax.swing.border.EmptyBorder;
 +import javax.swing.JButton;
 +import javax.swing.GroupLayout;
 +import javax.swing.GroupLayout.Alignment;
 +
 +import domain.Owner;
 +import domain.RuralHouse;
 +
 +import java.awt.event.ActionListener;
 +import java.awt.event.ActionEvent;
 +import java.util.Vector;
 +import javax.swing.JLabel;
 +import java.awt.Color;
 +import java.awt.Font;
 +
 +public class HousesRelatedOwnerGUI extends JFrame {
 +
 +      /**
 +       * 
 +       */
 +      private static final long serialVersionUID = 1L;
 +      private JPanel contentPane;
 +      private Owner owner;
 +      /**
 +       * Create the frame.
 +       */
 +      public HousesRelatedOwnerGUI(Owner o) {
 +              this.getContentPane().setLayout(null);
 +              owner = o;
-                               //TODO this button must direct to the House create GUI
 +              setBounds(100, 100, 450, 562);
 +              contentPane = new JPanel();
 +              contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
 +              setContentPane(contentPane);
 +              
 +              JButton btnCreateHouses = new JButton("Create Houses");
 +              btnCreateHouses.addActionListener(new ActionListener() {
 +                      public void actionPerformed(ActionEvent arg0) {
-                               //TODO this button must direct to the House modify GUI
++                              Frame a = new NewHouseGUI(owner);
++                              a.setVisible(true);
 +                      }
 +              });
 +              
 +              JButton btnModifyHouses = new JButton("Modify Houses");
++              btnModifyHouses.setEnabled(false);
 +              btnModifyHouses.addActionListener(new ActionListener() {
 +                      public void actionPerformed(ActionEvent e) {
-                               //TODO this button must direct to the House delete GUI
++                              
++                              /* TODO to be implemented in a future.
++                              Frame a = new ModifyHouseGUI(owner);
++                              a.setVisible(true);
++                              */
 +                      }
 +              });
 +              
 +              JButton btnDeleteHouses = new JButton("Delete Houses");
++              btnDeleteHouses.setEnabled(false);
 +              btnDeleteHouses.addActionListener(new ActionListener() {
 +                      public void actionPerformed(ActionEvent e) {
-               
-               JLabel lblDisabledYet = new JLabel("Disabled yet");
-               lblDisabledYet.setFont(new Font("Courier New", Font.PLAIN, 19));
-               lblDisabledYet.setForeground(Color.RED);
++                              Frame a = new DeleteHouseGUI(owner);
++                              a.setVisible(true);
 +                      }
 +              });
-                       gl_contentPane.createParallelGroup(Alignment.TRAILING)
 +              GroupLayout gl_contentPane = new GroupLayout(contentPane);
 +              gl_contentPane.setHorizontalGroup(
-                                               .addComponent(btnDeleteHouses, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 193, Short.MAX_VALUE)
-                                               .addComponent(btnModifyHouses, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 193, Short.MAX_VALUE)
-                                               .addComponent(btnCreateHouses, GroupLayout.DEFAULT_SIZE, 193, Short.MAX_VALUE))
++                      gl_contentPane.createParallelGroup(Alignment.LEADING)
 +                              .addGroup(gl_contentPane.createSequentialGroup()
 +                                      .addGap(110)
 +                                      .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
-                               .addGroup(Alignment.LEADING, gl_contentPane.createSequentialGroup()
-                                       .addGap(127)
-                                       .addComponent(lblDisabledYet)
-                                       .addContainerGap(165, Short.MAX_VALUE))
++                                              .addComponent(btnDeleteHouses, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 1125, Short.MAX_VALUE)
++                                              .addComponent(btnModifyHouses, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 1125, Short.MAX_VALUE)
++                                              .addComponent(btnCreateHouses, GroupLayout.DEFAULT_SIZE, 1125, Short.MAX_VALUE))
 +                                      .addGap(121))
-                                       .addGap(37)
-                                       .addComponent(lblDisabledYet)
-                                       .addGap(28)
 +              );
 +              gl_contentPane.setVerticalGroup(
 +                      gl_contentPane.createParallelGroup(Alignment.LEADING)
 +                              .addGroup(gl_contentPane.createSequentialGroup()
-                                       .addContainerGap(186, Short.MAX_VALUE))
++                                      .addGap(88)
 +                                      .addComponent(btnCreateHouses, GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE)
 +                                      .addGap(40)
 +                                      .addComponent(btnModifyHouses, GroupLayout.PREFERRED_SIZE, 57, GroupLayout.PREFERRED_SIZE)
 +                                      .addGap(39)
 +                                      .addComponent(btnDeleteHouses, GroupLayout.PREFERRED_SIZE, 54, GroupLayout.PREFERRED_SIZE)
++                                      .addContainerGap(394, Short.MAX_VALUE))
 +              );
 +              contentPane.setLayout(gl_contentPane);
 +      }
 +}
@@@ -14,7 -14,7 +14,7 @@@ import java.awt.event.ActionListener
  import java.awt.event.ActionEvent;
  import java.awt.Color;
  
- public class IntroduceOfferGUI extends JFrame {
+ public class LoginGUI extends JFrame {
  
        private static final long serialVersionUID= 1L;
        private JPanel jContentPane = null;
@@@ -23,7 -23,7 +23,7 @@@
        private LoginManagerInterface loginManager = new LoginManager();
        private JLabel loginFeedback;
  
-       public IntroduceOfferGUI() {
+       public LoginGUI() {
                super();
                initialize();
        }
                        JButton loginButton = new JButton("Login");
                        loginButton.addActionListener(new ActionListener() {
                                public void actionPerformed(ActionEvent arg0) {
-                                       Owner owner = loginManager.checkCredentials(usernameField.getText(),new String(passwordField.getPassword()));
-                                       if(owner==null){
-                                               loginFeedback.setText("Incorrect username or password");
-                                       }else{
-                                               Vector<RuralHouse> ownerHouseList=null;
-                                               try{
-                                                       ownerHouseList = StartWindow.getBusinessLogic().getRuralHouses(owner);
-                                               }catch (Exception e){
-                                                       e.printStackTrace();
-                                               }
-                                               if(!ownerHouseList.isEmpty()){
-                                                       Frame a = new OwnerMenuGUI(owner);
-                                                       a.setVisible(true);
-                                               }
-                                               else if(ownerHouseList.isEmpty())
-                                                       loginFeedback.setText("Login OK , but no houses in your name");
-                                       }
 +
-                               }
+                               jButton_ActionPerformed(arg0);  
+                               }                                       
                        });
                        loginButton.setBounds(164, 179, 117, 25);
                        jContentPane.add(loginButton);
                }
                return jContentPane;
        }
 -                      Vector<RuralHouse> ownerHouseList=null;
 -                      try{
 -                              ownerHouseList = StartWindow.getBusinessLogic().getRuralHouses(owner);
 -                      }catch (Exception e1){
 -                              e1.printStackTrace();
 -                      }
 -                      if(!ownerHouseList.isEmpty()){
+       
+       private void jButton_ActionPerformed(ActionEvent e){
+               Owner owner = loginManager.checkCredentials(usernameField.getText(),new String(passwordField.getPassword()));
+               if(owner==null){
+                       loginFeedback.setText("Incorrect username or password");
+               }else{
 -                              Frame a = new IntroduceOffer2GUI(ownerHouseList);
++                      
++                      
++                      
+                               this.setVisible(false);
 -                      }
 -                      else if(ownerHouseList.isEmpty())
 -                              loginFeedback.setText("Login OK , but no houses in your name");
 -              }
++                              Frame a = new OwnerMenuGUI(owner);
+                               a.setVisible(true);
++              }       
  
+       }
  
  }  // @jve:decl-index=0:visual-constraint="222,33"
  
index 0000000,0000000..a273b6e
new file mode 100644 (file)
--- /dev/null
--- /dev/null
@@@ -1,0 -1,0 +1,209 @@@
++package gui;
++
++import java.awt.BorderLayout;
++import java.awt.EventQueue;
++
++import javax.swing.JFrame;
++import javax.swing.JPanel;
++import javax.swing.border.EmptyBorder;
++import javax.swing.GroupLayout;
++import javax.swing.GroupLayout.Alignment;
++
++import domain.Owner;
++import javax.swing.JLabel;
++import javax.swing.JTextField;
++import javax.swing.LayoutStyle.ComponentPlacement;
++import javax.swing.SwingConstants;
++import javax.swing.JButton;
++import javax.swing.JComboBox;
++
++public class ModifyHouseGUI extends JFrame {
++
++      /**
++       * 
++       */
++      private static final long serialVersionUID = 1L;
++      private JPanel contentPane;
++      private Owner owner;
++      private JLabel lblTown;
++      private JTextField Town_f;
++      private JLabel lblDescription;
++      private JTextField description_f;
++      private JLabel lblKitchen;
++      private JTextField kitchens_f;
++      private JLabel lblRooms;
++      private JTextField rooms_f;
++      private JLabel lblLivings;
++      private JTextField lRooms_f;
++      private JLabel lblParkings;
++      private JTextField parkings_f;
++      private JLabel lblBaths;
++      private JTextField baths_f;
++      private JButton btnRegister;
++      private JComboBox comboBox;
++      
++
++
++      /**
++       * Create the frame.
++       */
++      public ModifyHouseGUI(Owner o) {
++              this.getContentPane().setLayout(null);
++              owner = o;
++              setBounds(100, 100, 500, 583);
++              contentPane = new JPanel();
++              contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
++              setContentPane(contentPane);
++              
++              JLabel lblCode = new JLabel("House Code:");
++              lblCode.setHorizontalAlignment(SwingConstants.RIGHT);
++              
++              lblTown = new JLabel("Town:");
++              lblTown.setHorizontalAlignment(SwingConstants.RIGHT);
++              
++              Town_f = new JTextField();
++              Town_f.setColumns(10);
++              
++              lblDescription = new JLabel("Description:");
++              lblDescription.setHorizontalAlignment(SwingConstants.RIGHT);
++              
++              description_f = new JTextField();
++              description_f.setColumns(10);
++              
++              lblKitchen = new JLabel("Kitchens:");
++              lblKitchen.setHorizontalAlignment(SwingConstants.RIGHT);
++              
++              kitchens_f = new JTextField();
++              kitchens_f.setColumns(10);
++              
++              lblRooms = new JLabel("Rooms:");
++              lblRooms.setHorizontalAlignment(SwingConstants.RIGHT);
++              
++              rooms_f = new JTextField();
++              rooms_f.setColumns(10);
++              
++              lblLivings = new JLabel("Living rooms:");
++              lblLivings.setHorizontalAlignment(SwingConstants.RIGHT);
++              
++              lRooms_f = new JTextField();
++              lRooms_f.setColumns(10);
++              
++              lblParkings = new JLabel("Parkings:");
++              lblParkings.setHorizontalAlignment(SwingConstants.RIGHT);
++              
++              parkings_f = new JTextField();
++              parkings_f.setColumns(10);
++              
++              lblBaths = new JLabel("Baths:");
++              lblBaths.setHorizontalAlignment(SwingConstants.RIGHT);
++              
++              baths_f = new JTextField();
++              baths_f.setColumns(10);
++              
++              btnRegister = new JButton("Register House");
++              
++              comboBox = new JComboBox();
++              GroupLayout gl_contentPane = new GroupLayout(contentPane);
++              gl_contentPane.setHorizontalGroup(
++                      gl_contentPane.createParallelGroup(Alignment.LEADING)
++                              .addGroup(gl_contentPane.createSequentialGroup()
++                                      .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
++                                              .addGroup(gl_contentPane.createSequentialGroup()
++                                                      .addContainerGap()
++                                                      .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
++                                                              .addGroup(gl_contentPane.createSequentialGroup()
++                                                                      .addComponent(lblParkings, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE)
++                                                                      .addGap(18)
++                                                                      .addComponent(parkings_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
++                                                              .addGroup(gl_contentPane.createSequentialGroup()
++                                                                      .addComponent(lblRooms, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE)
++                                                                      .addGap(18)
++                                                                      .addComponent(rooms_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
++                                                              .addGroup(gl_contentPane.createSequentialGroup()
++                                                                      .addComponent(lblCode)
++                                                                      .addPreferredGap(ComponentPlacement.UNRELATED)
++                                                                      .addComponent(comboBox, GroupLayout.PREFERRED_SIZE, 124, GroupLayout.PREFERRED_SIZE))
++                                                              .addGroup(gl_contentPane.createSequentialGroup()
++                                                                      .addComponent(lblBaths, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE)
++                                                                      .addGap(18)
++                                                                      .addComponent(baths_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
++                                                              .addGroup(gl_contentPane.createSequentialGroup()
++                                                                      .addComponent(lblTown, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE)
++                                                                      .addGap(18)
++                                                                      .addComponent(Town_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
++                                                      .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
++                                                              .addGroup(gl_contentPane.createSequentialGroup()
++                                                                      .addGap(17)
++                                                                      .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
++                                                                              .addGroup(gl_contentPane.createSequentialGroup()
++                                                                                      .addComponent(lblLivings)
++                                                                                      .addGap(18)
++                                                                                      .addComponent(lRooms_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
++                                                                              .addGroup(gl_contentPane.createSequentialGroup()
++                                                                                      .addComponent(lblKitchen, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE)
++                                                                                      .addGap(18)
++                                                                                      .addComponent(kitchens_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))))
++                                                              .addGroup(gl_contentPane.createSequentialGroup()
++                                                                      .addGap(18)
++                                                                      .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
++                                                                              .addGroup(gl_contentPane.createSequentialGroup()
++                                                                                      .addGap(10)
++                                                                                      .addComponent(description_f, GroupLayout.PREFERRED_SIZE, 178, GroupLayout.PREFERRED_SIZE))
++                                                                              .addComponent(lblDescription, GroupLayout.PREFERRED_SIZE, 90, GroupLayout.PREFERRED_SIZE)))))
++                                              .addGroup(gl_contentPane.createSequentialGroup()
++                                                      .addGap(140)
++                                                      .addComponent(btnRegister)))
++                                      .addContainerGap())
++              );
++              gl_contentPane.setVerticalGroup(
++                      gl_contentPane.createParallelGroup(Alignment.LEADING)
++                              .addGroup(gl_contentPane.createSequentialGroup()
++                                      .addGap(20)
++                                      .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
++                                              .addGroup(gl_contentPane.createSequentialGroup()
++                                                      .addGap(60)
++                                                      .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
++                                                              .addComponent(lblCode)
++                                                              .addComponent(comboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
++                                                      .addPreferredGap(ComponentPlacement.UNRELATED)
++                                                      .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
++                                                              .addComponent(Town_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
++                                                              .addComponent(lblTown)))
++                                              .addGroup(gl_contentPane.createSequentialGroup()
++                                                      .addGap(63)
++                                                      .addComponent(lblDescription)
++                                                      .addPreferredGap(ComponentPlacement.UNRELATED)
++                                                      .addComponent(description_f, GroupLayout.PREFERRED_SIZE, 129, GroupLayout.PREFERRED_SIZE)))
++                                      .addGap(71)
++                                      .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
++                                              .addGroup(gl_contentPane.createSequentialGroup()
++                                                      .addGap(3)
++                                                      .addComponent(lblRooms))
++                                              .addComponent(rooms_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
++                                              .addGroup(gl_contentPane.createSequentialGroup()
++                                                      .addGap(3)
++                                                      .addComponent(lblKitchen))
++                                              .addComponent(kitchens_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
++                                      .addGap(18)
++                                      .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
++                                              .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
++                                                      .addGroup(gl_contentPane.createSequentialGroup()
++                                                              .addGap(3)
++                                                              .addComponent(lblBaths))
++                                                      .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
++                                                              .addComponent(baths_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
++                                                              .addComponent(lblLivings)))
++                                              .addComponent(lRooms_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
++                                      .addGap(30)
++                                      .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
++                                              .addGroup(gl_contentPane.createSequentialGroup()
++                                                      .addGap(3)
++                                                      .addComponent(lblParkings))
++                                              .addComponent(parkings_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
++                                      .addGap(41)
++                                      .addComponent(btnRegister)
++                                      .addGap(54))
++              );
++              contentPane.setLayout(gl_contentPane);
++      }
++}
index 4139091,0000000..bb72996
mode 100644,000000..100644
--- /dev/null
@@@ -1,209 -1,0 +1,238 @@@
-               setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-               setBounds(100, 100, 450, 583);
 +package gui;
 +
 +import java.awt.BorderLayout;
 +import java.awt.EventQueue;
 +
 +import javax.swing.JFrame;
 +import javax.swing.JPanel;
 +import javax.swing.border.EmptyBorder;
 +import javax.swing.GroupLayout;
 +import javax.swing.GroupLayout.Alignment;
 +
++import domain.HouseFeatures;
 +import domain.Owner;
++import domain.RuralHouse;
++
 +import javax.swing.JLabel;
 +import javax.swing.JTextField;
 +import javax.swing.LayoutStyle.ComponentPlacement;
 +import javax.swing.SwingConstants;
 +import javax.swing.JButton;
++import java.awt.Color;
++import java.awt.event.ActionListener;
++import java.awt.event.ActionEvent;
++import javax.swing.JTextPane;
++
++import businessLogic.HouseManager;
 +
 +public class NewHouseGUI extends JFrame {
 +
 +      /**
 +       * 
 +       */
 +      private static final long serialVersionUID = 1L;
 +      private JPanel contentPane;
 +      private Owner owner;
++      private JLabel lblCode ;
 +      private JTextField Code_f;
 +      private JLabel lblTown;
 +      private JTextField Town_f;
 +      private JLabel lblDescription;
 +      private JTextField description_f;
 +      private JLabel lblKitchen;
 +      private JTextField kitchens_f;
 +      private JLabel lblRooms;
 +      private JTextField rooms_f;
 +      private JLabel lblLivings;
 +      private JTextField lRooms_f;
 +      private JLabel lblParkings;
 +      private JTextField parkings_f;
 +      private JLabel lblBaths;
 +      private JTextField baths_f;
 +      private JButton btnRegister;
 +
 +
 +      /**
 +       * Create the frame.
 +       */
 +      public NewHouseGUI(Owner o) {
++              this.setTitle("New House");
++              setBackground(Color.WHITE);
 +              this.getContentPane().setLayout(null);
 +              owner = o;
-               JLabel lblCode = new JLabel("House Code:");
++              setBounds(100, 100, 500, 583);
 +              contentPane = new JPanel();
 +              contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
 +              setContentPane(contentPane);
 +              
-               lblDescription = new JLabel("Description:");
++              lblCode = new JLabel("House Code:");
 +              lblCode.setHorizontalAlignment(SwingConstants.RIGHT);
 +              
 +              Code_f = new JTextField();
 +              Code_f.setColumns(10);
 +              
 +              lblTown = new JLabel("Town:");
 +              lblTown.setHorizontalAlignment(SwingConstants.RIGHT);
 +              
 +              Town_f = new JTextField();
 +              Town_f.setColumns(10);
 +              
-                                                                       .addComponent(lblParkings, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE)
-                                                                       .addGap(18)
-                                                                       .addComponent(parkings_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
-                                                               .addGroup(gl_contentPane.createSequentialGroup()
-                                                                       .addComponent(lblRooms, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE)
-                                                                       .addGap(18)
-                                                                       .addComponent(rooms_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
-                                                               .addGroup(gl_contentPane.createSequentialGroup()
-                                                                       .addComponent(lblCode)
-                                                                       .addGap(18)
-                                                                       .addComponent(Code_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
-                                                               .addGroup(gl_contentPane.createSequentialGroup()
-                                                                       .addComponent(lblBaths, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE)
-                                                                       .addGap(18)
-                                                                       .addComponent(baths_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
++              lblDescription = new JLabel("Description(optional):");
 +              lblDescription.setHorizontalAlignment(SwingConstants.RIGHT);
 +              
 +              description_f = new JTextField();
++              description_f.setToolTipText("");
++              description_f.setHorizontalAlignment(SwingConstants.LEFT);
 +              description_f.setColumns(10);
 +              
 +              lblKitchen = new JLabel("Kitchens:");
 +              lblKitchen.setHorizontalAlignment(SwingConstants.RIGHT);
 +              
 +              kitchens_f = new JTextField();
 +              kitchens_f.setColumns(10);
 +              
 +              lblRooms = new JLabel("Rooms:");
 +              lblRooms.setHorizontalAlignment(SwingConstants.RIGHT);
 +              
 +              rooms_f = new JTextField();
 +              rooms_f.setColumns(10);
 +              
 +              lblLivings = new JLabel("Living rooms:");
 +              lblLivings.setHorizontalAlignment(SwingConstants.RIGHT);
 +              
 +              lRooms_f = new JTextField();
 +              lRooms_f.setColumns(10);
 +              
 +              lblParkings = new JLabel("Parkings:");
 +              lblParkings.setHorizontalAlignment(SwingConstants.RIGHT);
 +              
 +              parkings_f = new JTextField();
 +              parkings_f.setColumns(10);
 +              
 +              lblBaths = new JLabel("Baths:");
 +              lblBaths.setHorizontalAlignment(SwingConstants.RIGHT);
 +              
 +              baths_f = new JTextField();
 +              baths_f.setColumns(10);
 +              
 +              btnRegister = new JButton("Register House");
++              btnRegister.addActionListener(new ActionListener() {
++                      public void actionPerformed(ActionEvent arg0) {
++                              try {
++                                      HouseManager hm = new HouseManager();
++                                      hm.registerNewHouse(Integer.parseInt(Code_f.getText()),
++                                                              owner, description_f.getText(),
++                                                              Town_f.getText() ,Integer.parseInt(rooms_f.getText()),
++                                                                              Integer.parseInt(kitchens_f.getText()),
++                                                                              Integer.parseInt(baths_f.getText()),
++                                                                              Integer.parseInt(lRooms_f.getText()),
++                                                                              Integer.parseInt(parkings_f.getText()) );
++                              
++                              }
++                              catch(NumberFormatException e ){
++                                      e.printStackTrace();
++                              }
++                      }
++              });
 +              GroupLayout gl_contentPane = new GroupLayout(contentPane);
 +              gl_contentPane.setHorizontalGroup(
 +                      gl_contentPane.createParallelGroup(Alignment.LEADING)
 +                              .addGroup(gl_contentPane.createSequentialGroup()
 +                                      .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
++                                              .addGroup(gl_contentPane.createSequentialGroup()
++                                                      .addGap(140)
++                                                      .addComponent(btnRegister))
 +                                              .addGroup(gl_contentPane.createSequentialGroup()
 +                                                      .addContainerGap()
 +                                                      .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
 +                                                              .addGroup(gl_contentPane.createSequentialGroup()
-                                                                       .addComponent(lblTown, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE)
++                                                                      .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
++                                                                              .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
++                                                                                      .addGroup(gl_contentPane.createSequentialGroup()
++                                                                                              .addComponent(lblTown, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE)
++                                                                                              .addGap(18)
++                                                                                              .addComponent(Town_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
++                                                                                      .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING, false)
++                                                                                              .addGroup(gl_contentPane.createSequentialGroup()
++                                                                                                      .addComponent(lblLivings)
++                                                                                                      .addGap(18)
++                                                                                                      .addComponent(lRooms_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
++                                                                                              .addGroup(gl_contentPane.createSequentialGroup()
++                                                                                                      .addComponent(lblCode)
++                                                                                                      .addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
++                                                                                                      .addComponent(Code_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))))
++                                                                              .addGroup(gl_contentPane.createSequentialGroup()
++                                                                                      .addComponent(lblBaths, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE)
++                                                                                      .addGap(18)
++                                                                                      .addComponent(baths_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
++                                                                      .addGap(29)
++                                                                      .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
++                                                                              .addComponent(lblDescription)
++                                                                              .addComponent(description_f, GroupLayout.PREFERRED_SIZE, 164, GroupLayout.PREFERRED_SIZE)))
 +                                                              .addGroup(gl_contentPane.createSequentialGroup()
-                                                                       .addComponent(Town_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
-                                                       .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
++                                                                      .addComponent(lblKitchen, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE)
 +                                                                      .addGap(18)
-                                                                       .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
-                                                                               .addComponent(lblDescription, GroupLayout.PREFERRED_SIZE, 90, GroupLayout.PREFERRED_SIZE)
-                                                                               .addGroup(gl_contentPane.createSequentialGroup()
-                                                                                       .addGap(10)
-                                                                                       .addComponent(description_f, GroupLayout.DEFAULT_SIZE, 201, Short.MAX_VALUE))))
-                                                               .addGroup(gl_contentPane.createSequentialGroup()
-                                                                       .addGap(17)
-                                                                       .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
-                                                                               .addGroup(gl_contentPane.createSequentialGroup()
-                                                                                       .addComponent(lblLivings)
-                                                                                       .addGap(18)
-                                                                                       .addComponent(lRooms_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
-                                                                               .addGroup(gl_contentPane.createSequentialGroup()
-                                                                                       .addComponent(lblKitchen, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE)
-                                                                                       .addGap(18)
-                                                                                       .addComponent(kitchens_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))))))
++                                                                      .addComponent(kitchens_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
 +                                                              .addGroup(gl_contentPane.createSequentialGroup()
++                                                                      .addComponent(lblRooms, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE)
 +                                                                      .addGap(18)
-                                                       .addGap(140)
-                                                       .addComponent(btnRegister)))
-                                       .addContainerGap())
++                                                                      .addComponent(rooms_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))))
 +                                              .addGroup(gl_contentPane.createSequentialGroup()
-                                                               .addComponent(lblTown)))
-                                               .addGroup(gl_contentPane.createSequentialGroup()
-                                                       .addGap(63)
-                                                       .addComponent(lblDescription)
-                                                       .addPreferredGap(ComponentPlacement.UNRELATED)
-                                                       .addComponent(description_f, GroupLayout.PREFERRED_SIZE, 129, GroupLayout.PREFERRED_SIZE)))
-                                       .addGap(71)
++                                                      .addGap(26)
++                                                      .addComponent(lblParkings, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE)
++                                                      .addPreferredGap(ComponentPlacement.UNRELATED)
++                                                      .addComponent(parkings_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
++                                      .addContainerGap(885, Short.MAX_VALUE))
 +              );
 +              gl_contentPane.setVerticalGroup(
 +                      gl_contentPane.createParallelGroup(Alignment.LEADING)
 +                              .addGroup(gl_contentPane.createSequentialGroup()
 +                                      .addGap(20)
 +                                      .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
++                                              .addGroup(gl_contentPane.createSequentialGroup()
++                                                      .addGap(63)
++                                                      .addComponent(lblDescription)
++                                                      .addPreferredGap(ComponentPlacement.RELATED)
++                                                      .addComponent(description_f, GroupLayout.PREFERRED_SIZE, 37, GroupLayout.PREFERRED_SIZE))
 +                                              .addGroup(gl_contentPane.createSequentialGroup()
 +                                                      .addGap(60)
 +                                                      .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
 +                                                              .addComponent(lblCode)
 +                                                              .addComponent(Code_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
 +                                                      .addPreferredGap(ComponentPlacement.UNRELATED)
 +                                                      .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
 +                                                              .addComponent(Town_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
-                                               .addComponent(rooms_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
++                                                              .addComponent(lblTown))
++                                                      .addGap(18)
++                                                      .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
++                                                              .addComponent(lblLivings)
++                                                              .addComponent(lRooms_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))))
++                                      .addGap(63)
 +                                      .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
 +                                              .addGroup(gl_contentPane.createSequentialGroup()
 +                                                      .addGap(3)
 +                                                      .addComponent(lblRooms))
-                                                       .addComponent(lblKitchen))
-                                               .addComponent(kitchens_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
-                                       .addGap(18)
-                                       .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
-                                               .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
-                                                       .addGroup(gl_contentPane.createSequentialGroup()
-                                                               .addGap(3)
-                                                               .addComponent(lblBaths))
-                                                       .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
-                                                               .addComponent(baths_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
-                                                               .addComponent(lblLivings)))
-                                               .addComponent(lRooms_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
-                                       .addGap(30)
++                                              .addComponent(rooms_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
++                                      .addPreferredGap(ComponentPlacement.RELATED)
++                                      .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
++                                              .addComponent(kitchens_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
 +                                              .addGroup(gl_contentPane.createSequentialGroup()
 +                                                      .addGap(3)
-                                                       .addComponent(lblParkings))
++                                                      .addComponent(lblKitchen)))
++                                      .addPreferredGap(ComponentPlacement.RELATED, 206, Short.MAX_VALUE)
 +                                      .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
 +                                              .addGroup(gl_contentPane.createSequentialGroup()
 +                                                      .addGap(3)
-                                       .addGap(41)
++                                                      .addComponent(lblBaths))
++                                              .addComponent(baths_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
++                                      .addGap(45)
++                                      .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
++                                              .addComponent(lblParkings)
 +                                              .addComponent(parkings_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
++                                      .addGap(88)
 +                                      .addComponent(btnRegister)
 +                                      .addGap(54))
 +              );
 +              contentPane.setLayout(gl_contentPane);
 +      }
 +}
index 4cc4f43,0000000..532d373
mode 100644,000000..100644
--- /dev/null
@@@ -1,80 -1,0 +1,80 @@@
-               setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 +package gui;
 +
 +import java.awt.BorderLayout;
 +import java.awt.EventQueue;
 +import java.awt.Frame;
 +
 +import javax.swing.JFrame;
 +import javax.swing.JPanel;
 +import javax.swing.border.EmptyBorder;
 +import javax.swing.GroupLayout;
 +import javax.swing.GroupLayout.Alignment;
 +import javax.swing.JButton;
 +
 +import domain.Owner;
 +import domain.RuralHouse;
 +
 +import java.awt.event.ActionListener;
 +import java.awt.event.ActionEvent;
 +import java.util.Vector;
 +
 +public class OwnerMenuGUI extends JFrame {
 +
 +      /**
 +       * 
 +       */
 +      private static final long serialVersionUID = 1L;
 +      private JPanel contentPane;
 +      private Owner owner;
 +
 +
 +      /**
 +       * Create the frame.
 +       */
 +      public OwnerMenuGUI(Owner o) {
++              this.setTitle("Owner Menu");
 +              this.getContentPane().setLayout(null);
 +              owner = o;
 +              setBounds(100, 100, 450, 473);
 +              contentPane = new JPanel();
 +              contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
 +              setContentPane(contentPane);
 +              
 +              JButton btnHouses = new JButton("Houses");
 +              btnHouses.addActionListener(new ActionListener() {
 +                      public void actionPerformed(ActionEvent e) {
 +                              Frame a = new HousesRelatedOwnerGUI(owner);
 +                              a.setVisible(true);
 +                      }
 +              });
 +              
 +              JButton btnOffers = new JButton("Offers");
 +              btnOffers.addActionListener(new ActionListener() {
 +                      public void actionPerformed(ActionEvent e) {
 +                              Frame a = new IntroduceOffer2GUI(owner.getRuralHouses());
 +                              a.setVisible(true);
 +                      }
 +              });
 +              GroupLayout gl_contentPane = new GroupLayout(contentPane);
 +              gl_contentPane.setHorizontalGroup(
 +                      gl_contentPane.createParallelGroup(Alignment.LEADING)
 +                              .addGroup(gl_contentPane.createSequentialGroup()
 +                                      .addGap(115)
 +                                      .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
 +                                              .addComponent(btnOffers, GroupLayout.PREFERRED_SIZE, 164, GroupLayout.PREFERRED_SIZE)
 +                                              .addComponent(btnHouses, GroupLayout.PREFERRED_SIZE, 164, GroupLayout.PREFERRED_SIZE))
 +                                      .addContainerGap(145, Short.MAX_VALUE))
 +              );
 +              gl_contentPane.setVerticalGroup(
 +                      gl_contentPane.createParallelGroup(Alignment.LEADING)
 +                              .addGroup(gl_contentPane.createSequentialGroup()
 +                                      .addGap(62)
 +                                      .addComponent(btnHouses, GroupLayout.PREFERRED_SIZE, 81, GroupLayout.PREFERRED_SIZE)
 +                                      .addGap(58)
 +                                      .addComponent(btnOffers, GroupLayout.PREFERRED_SIZE, 81, GroupLayout.PREFERRED_SIZE)
 +                                      .addContainerGap(142, Short.MAX_VALUE))
 +              );
 +              contentPane.setLayout(gl_contentPane);
 +      }
 +
 +}
@@@ -41,7 -41,7 +41,7 @@@ public class StartWindow extends JFram
                // this.setSize(271, 295);
                this.setSize(350, 400);
                this.setContentPane(getJContentPane());
--              this.setTitle("Use Cases");
++              this.setTitle("Rural Houses");
        }
  
        private JPanel getJContentPane() {
@@@ -87,7 -87,7 +87,7 @@@
                        createOfferButton.setAlignmentX(Component.CENTER_ALIGNMENT);
                        createOfferButton.addActionListener(new java.awt.event.ActionListener() {
                                public void actionPerformed(java.awt.event.ActionEvent e) {
-                                       JFrame a = new IntroduceOfferGUI();
+                                       JFrame a = new LoginGUI();
                                        a.setVisible(true);
                                }
                        });