Merge branch 'master' of ssh://xp-dev.com/RRRRHHHH_Code
authorpinene <epinzolas001@ikasle.ehu.eus>
Wed, 20 May 2015 16:42:17 +0000 (18:42 +0200)
committerpinene <epinzolas001@ikasle.ehu.eus>
Wed, 20 May 2015 16:42:17 +0000 (18:42 +0200)
Conflicts:
ruralHouses client/src/domain/Owner.java
ruralHouses client/src/domain/RuralHouse.java
ruralHouses client/src/gui/BookRuralHouseConfirmationWindow.java
ruralHouses client/src/gui/ModifyOfferGUI.java
ruralHouses/src/dataAccess/DB4oManager.java
ruralHouses/src/domain/Booking.java

32 files changed:
1  2 
ruralHouses client/src/common/BookingInterface.java
ruralHouses client/src/domain/Administrator.java
ruralHouses client/src/domain/Owner.java
ruralHouses client/src/domain/RuralHouse.java
ruralHouses client/src/gui/BookRuralHouseConfirmationWindow.java
ruralHouses client/src/gui/DeleteOwnerGUI.java
ruralHouses client/src/gui/HouseFeaturesGUI.java
ruralHouses client/src/gui/ModifyOfferGUI.java
ruralHouses client/src/gui/listOfOffers.java
ruralHouses/src/businessLogic/AdminManager.java
ruralHouses/src/businessLogic/BookingManager.java
ruralHouses/src/common/BookingInterface.java
ruralHouses/src/dataAccess/DB4oManager.java
ruralHouses/src/domain/Account.java
ruralHouses/src/domain/Administrator.java
ruralHouses/src/domain/Booking.java
ruralHouses/src/domain/Client.java
ruralHouses/src/domain/Owner.java
ruralHouses/src/domain/RuralHouse.java
ruralHouses/src/gui/AdminMenuGUI.java
ruralHouses/src/gui/BookRuralHouseConfirmationWindow.java
ruralHouses/src/gui/DeleteOfferGUI.java
ruralHouses/src/gui/DeleteOwnerGUI.java
ruralHouses/src/gui/HouseFeaturesGUI.java
ruralHouses/src/gui/ModifyHouseGUI.java
ruralHouses/src/gui/ModifyOfferGUI.java
ruralHouses/src/gui/OwnerRegistrationGUI.java
ruralHouses/src/gui/listOfAdditionRequestsGUI.java
ruralHouses/src/gui/listOfBookingRequestsGUI.java
ruralHouses/src/gui/listOfOffers.java
ruralHouses/src/gui/listOfOwnerAddittionRequests.java
ruralHouses/src/gui/listOfRemovalRequestsGUI.java

@@@ -13,9 -13,10 +13,9 @@@ import exceptions.OfferCanNotBeBooked
  public interface BookingInterface extends Remote {
  
  
 -      public int getNumber() throws RemoteException;
  
  
-       public void removeDenyBooking(Booking b) throws RemoteException;
+       public void denyBooking(Booking b) throws RemoteException;
  
  
        public void acceptBooking(Booking b) throws RemoteException;
@@@ -12,7 -12,6 +12,7 @@@ public class Administrator implements S
         */
        private static final long serialVersionUID = 1L;
  
 +      private static Administrator admin = null;
        private static LinkedList<RuralHouse> addRequest;
        private static LinkedList<RuralHouse> removeRequest;
        private static LinkedList<Account> newOwnerRequest;
                newOwnerRequest = new LinkedList<Account>();
        }
  
 -      public static Administrator getInstance() {
 -              return null;
 -
 -
 -      }
 -
 -      public static void saveInstance() {
 -
 -      }
--
++      
        public LinkedList<RuralHouse> getAddRequest() {
                return addRequest;
        }
@@@ -14,10 -14,6 +14,6 @@@ public class Owner implements Serializa
        private String mailAccount = "";
        private Vector<RuralHouse> ruralHouses;
  
- //    public Owner(String name) {
- //            this.name = name;
- //            ruralHouses = new hVector<RuralHouse>();
- //    }
  
        public Owner(String name, String bankAccount,String mail) {
                this.bankAccount = bankAccount;
                this.mailAccount = mailAccount;
        }
        
 -      public Vector<Offer> getAllOffers (){
 -              Vector<Offer> offers = new Vector<Offer>();
 -              for(RuralHouse rh: this.ruralHouses){
 -                      for(Offer of : rh.getAllOffers()){
 -                      offers.add(of);
 -                      }
 -              }
 -              return offers;
 -      }
 +      
  
  }
@@@ -14,8 -14,9 +14,9 @@@ public class RuralHouse implements Seri
        private Owner owner;
        private String district;
        private HouseFeatures features;
 -      private Vector<Offer> offers;
 -      private boolean isAccepted;
 +      public Vector<Offer> offers;
 +
        public RuralHouse() {
                super();
        }
                return true;
        }
  
 -      /**
 -       * This method obtains available offers for a concrete house in a certain
 -       * period
 -       * 
 -       * @param houseName
 -       *            , the house number where the offers must be obtained
 -       * @param firstDay
 -       *            , first day in a period range
 -       * @param lastDay
 -       *            , last day in a period range
 -       * @return a vector of offers(Offer class) available in this period
 -       */
 -      public Vector<Offer> getOffers(Date firstDay, Date lastDay) {
 -              Vector<Offer> availableOffers = new Vector<Offer>();
 -              Iterator<Offer> e = offers.iterator();
 -              Offer offer;
 -              while (e.hasNext()) {
 -                      offer = e.next();
 -                      if ((offer.getFirstDay().compareTo(firstDay) >= 0)
 -                                      && (offer.getLastDay().compareTo(lastDay) <= 0)
 -                                      && (!offer.isBooked()))
 -                              availableOffers.add(offer);
 -              }
 -              return availableOffers;
 -      }
 -
 -      public Vector<Offer> getAllOffers() {
  
 -              return this.offers;
 -      }
 -
 -      /**
 -       * This method obtains the offer that match exactly with a given dates that
 -       * has not been booked
 -       * 
 -       * @param firstDay
 -       *            , first day in a period range
 -       * @param lastDay
 -       *            , last day in a period range
 -       * @return the offer(Offer class) available for a this period
 -       */
 -      public Offer findOffer(Date firstDay, Date lastDay) {
 -              Iterator<Offer> e = offers.iterator();
 -              Offer offer = null;
 -              while (e.hasNext()) {
 -                      offer = e.next();
 -                      if ((offer.getFirstDay().compareTo(firstDay) == 0)
 -                                      && (offer.getLastDay().compareTo(lastDay) == 0)
 -                                      && (!offer.isBooked()))
 -                              return offer;
 -              }
 -              return null;
 -      }
  
        public Offer overlapsWith(Date firstDay, Date lastDay) {
  
                return null;
  
        }
 +      
  
 -      public boolean isAccepted() {
 -              return isAccepted;
 -      }
 +      public Vector<Offer> getAllOffers() {
  
 -      public void setAccepted(boolean isAccepted) {
 -              this.isAccepted = isAccepted;
 +              return this.offers;
        }
  
++
  }
@@@ -79,10 -79,10 +79,11 @@@ public class BookRuralHouseConfirmation
      jTextField3.setBounds(new Rectangle(180, 140, 115, 25));
      jTextField3.setEditable(false);
  
-     jTextField3.setText(Float.toString(book.getOffer().getPrice()) + " ï¿½");
 -    jTextField3.setText(Float.toString(book.getPrice()) + "\80");
++    jTextField3.setText(Float.toString(book.getOffer().getPrice()) + " \80");
      jTextField4.setBounds(new Rectangle(180, 175, 115, 25));
      jTextField4.setEditable(false);
-     jTextField4.setText(Float.toString(book.getOffer().getPrice()*(float)0.2) + " ï¿½");
 -    jTextField4.setText(Float.toString(book.getPrice()*(float)0.2) + "\80");
++    jTextField4.setText(Float.toString(book.getOffer().getPrice()*(float)0.2) + " \80");
++
      this.getContentPane().add(jTextField4, null);
      this.getContentPane().add(jTextField3, null);
      this.getContentPane().add(jLabel5, null);
index 0000000,19d5513..982e022
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,139 +1,139 @@@
 -              JLabel feedback = new JLabel("");
+ package gui;
+ import java.awt.Font;
+ import java.awt.Rectangle;
+ import java.awt.event.ActionEvent;
+ import java.awt.event.ActionListener;
+ import java.rmi.Naming;
+ import java.rmi.RemoteException;
+ import java.util.Enumeration;
+ import java.util.Vector;
+ import javax.swing.JButton;
+ import javax.swing.JFrame;
+ import javax.swing.JLabel;
+ import javax.swing.JPanel;
+ import javax.swing.JScrollPane;
+ import javax.swing.JTable;
+ import javax.swing.border.EmptyBorder;
+ import javax.swing.table.DefaultTableModel;
+ import common.AccountInterface;
+ import common.AdminInterface;
+ import configuration.___IntNames;
+ import domain.Owner;
+ public class DeleteOwnerGUI extends JFrame {
+       /**
+        * 
+        */
+       private static final long serialVersionUID = 1L;
+       private JPanel contentPane;
+       private JTable table;
+       private DefaultTableModel tableModel;
+       private AdminInterface AdM = null;
+       private Vector<Owner> owners = new Vector<Owner>();
+       /**
+        * Create the frame.
+        */
+       public DeleteOwnerGUI() {
+               setTitle("Current owners:");
+               try {
+                       init();
+               } catch (Exception e) {
+                       e.printStackTrace();
+               }
+       }
+       private void init() throws Exception {
+               setBounds(100, 100, 600, 500);
+               contentPane = new JPanel();
+               contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
+               setContentPane(contentPane);
+               contentPane.setLayout(null);
+               try {
+                       AdM = (AdminInterface) Naming
+                                       .lookup(___IntNames.AdminManager);
+               } catch (Exception e1) {
+                       System.out
+                                       .println("Error accessing remote authentication: "
+                                                       + e1.toString());
+               }
+               this.owners = AdM.getAllOwners();
+               JLabel lblNewLabel = new JLabel();
+               lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 27));
+               lblNewLabel.setBounds(23, 41, 536, 33);
+               contentPane.add(lblNewLabel);
+               if (this.owners.isEmpty())
+                       lblNewLabel
+                                       .setText("There are not owners in the system");
+               else
+                       lblNewLabel.setText("List of owners:");
+               JScrollPane scrollPane = new JScrollPane();
+               scrollPane.setBounds(new Rectangle(45, 305, 320, 116));
+               scrollPane.setBounds(23, 113, 536, 271);
+               contentPane.add(scrollPane);
++              final JLabel feedback = new JLabel("");
+               feedback.setBounds(134, 447, 307, 14);
+               contentPane.add(feedback);
+               JButton btnNewButton = new JButton("Delete from the system");
+               btnNewButton.addActionListener(new ActionListener() {
+                       public void actionPerformed(ActionEvent e) {
+                               if (table.getRowCount()!=0 && table.getSelectedRow() != -1) {
+                                       AccountInterface acm = null;
+                                       
+                                       try {
+                                               acm = (AccountInterface) Naming
+                                                               .lookup(___IntNames.AccountManager);
+                                       } catch (Exception e1) {
+                                               System.out.println("Error accessing remote authentication: "
+                                                               + e1.toString());
+                                       }
+                                       try {
+                                               if(acm.removeAccount(table.getSelectedRow()))
+                                                       {
+                                                       feedback.setText("Deleted from the system");
+                                                       }
+                                       } catch (RemoteException e1) {
+                                               e1.printStackTrace();
+                                       }
+                                       
+                                       ((DefaultTableModel)table.getModel()).removeRow(table.getSelectedRow());
+                               }
+                       }
+               });
+               btnNewButton.setBounds(88, 396, 428, 40);
+               contentPane.add(btnNewButton);
+               table = new JTable() {
+                       private static final long serialVersionUID = 1L;
+                       public boolean isCellEditable(int row, int column) {
+                               return false;
+                       };
+               };
+               
+               scrollPane.setViewportView(table);      
+               tableModel = new DefaultTableModel(null, new String[] {
+                               "Name", "E-mail", "Bank Account" });
+               table.setModel(tableModel);
+               
+               
+               Enumeration<Owner> rhs = this.owners.elements();
+               while (rhs.hasMoreElements()) {
+                       Owner own = rhs.nextElement();
+                       Vector<Object> row = new Vector<Object>();
+                       row.add(own.getName());
+                       row.add(own.getMailAccount());
+                       row.add(own.getBankAccount());
+                       tableModel.addRow(row);
+               }
+               
+               
+       }
+ }
@@@ -55,6 -55,7 +55,7 @@@ public class HouseFeaturesGUI extends J
        private JTable table;
        private DefaultTableModel tableModel;
        private RuralHouse rh;
+       private Vector<Offer> offers= new Vector<Offer>();
        private JTextField telIn;
        private int row;
        private JLabel labelPhone;
                                row = table.getSelectedRow();
                        }
                });
 +              
                Enumeration<Offer> rhs = rh.getAllOffers().elements();
                while (rhs.hasMoreElements()) {
                        Offer of = rhs.nextElement();
-                       if (of.getBookings() != null) {
+                       if (of.getBookings() == null
+                                       || !of.isBooked()) {
+                               offers.add(of);
                                Vector<Object> row = new Vector<Object>();
                                row.add(of.getOfferNumber());
                                row.add(of.getFirstDay());
                                if (table.getRowCount() != 0) {
                                        Client cl = new Client(nameField.getText(),
                                                        mailField.getText(), telIn.getText());
-                                       book = bookingM.createBooking(rh, rh.offers.get(row)
-                                                       .getFirstDay(), rh.offers.get(row).getLastDay(),cl);
+                                       book = bookingM.createBooking(rh, offers.get(row)
+                                                       .getFirstDay(), offers.get(row).getLastDay(),cl);
                                }
                        } catch (Exception e) {
                                e.printStackTrace();
@@@ -26,9 -26,9 +26,9 @@@ import javax.swing.JLabel
  import javax.swing.JTextField;
  
  import com.toedter.calendar.JCalendar;
  import common.HouseInterface;
  import common.OfferInterface;
  import configuration.___IntNames;
  import domain.Offer;
  import domain.Owner;
@@@ -89,9 -89,7 +89,9 @@@ public class ModifyOfferGUI extends JFr
                        Hlist = hm.getHouses(o, null, null, 0, 0, 0, 0, 0);
                } catch (RemoteException e1) {
                        e1.printStackTrace();
 -              }               
 +              }
 +
-               
++
                jComboBox1 = new JComboBox<RuralHouse>(Hlist);
  
                comboBox_o = new JComboBox<Offer>(
  
                        @Override
                        public void itemStateChanged(ItemEvent arg0) {
                                Vector<Offer> vo= null;
                                try {
                                        vo = om.getRuralHouseOffers((RuralHouse) jComboBox1.getSelectedItem());
@@@ -1,5 -1,7 +1,7 @@@
  package gui;
  
+ import java.awt.Color;
+ import java.awt.Component;
  import java.awt.Font;
  import java.awt.Rectangle;
  import java.awt.event.MouseAdapter;
@@@ -13,11 -15,11 +15,12 @@@ import javax.swing.JPanel
  import javax.swing.JScrollPane;
  import javax.swing.JTable;
  import javax.swing.border.EmptyBorder;
+ import javax.swing.table.DefaultTableCellRenderer;
  import javax.swing.table.DefaultTableModel;
  
  import domain.Offer;
  import domain.Owner;
 +import domain.RuralHouse;
  
  public class listOfOffers extends JFrame {
  
                contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
                setContentPane(contentPane);
                contentPane.setLayout(null);
 -
 -              this.offers = this.owner.getAllOffers();
 +              this.offers = new Vector<Offer>();
 +              for (RuralHouse rh: this.owner.getRuralHouses()){
 +                      this.offers.addAll(rh.getAllOffers());
 +              }
                JLabel lblNewLabel = new JLabel();
                lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 27));
                lblNewLabel.setBounds(23, 41, 536, 33);
                        row.add(of.getPrice());
                        row.add(of.getRuralHouse().getHouseName());
                        tableModel.addRow(row);
                }
+               
+               table.setDefaultRenderer(Object.class, new DefaultTableCellRenderer() {
+                       /**
+                        * 
+                        */
+                       private static final long serialVersionUID = 1L;
+                       @Override
+                       public Component getTableCellRendererComponent(JTable table,
+                                       Object value, boolean isSelected, boolean hasFocus,
+                                       int row, int col) {
+                               super.getTableCellRendererComponent(table, value, isSelected,
+                                               hasFocus, row, col);
+                               if (!offers.get(row).isBooked()) {
+                                       setBackground(Color.ORANGE);
+                                       setForeground(Color.BLACK);
+                               } else {
+                                       setBackground(Color.GREEN);
+                                       setForeground(Color.BLACK);
+                               }
+                               return this;
+                       }
+               });
  
        }
  }
@@@ -6,6 -6,7 +6,7 @@@ import java.util.Vector
  
  import common.AdminInterface;
  
+ import dataAccess.DB4oManager;
  import domain.Account;
  import domain.Administrator;
  import domain.Owner;
@@@ -39,6 -40,14 +40,14 @@@ public class AdminManager extends Unica
                                .getNewOwnerRequest());
        }
        
+       public Vector<Owner> getAllOwners()throws RemoteException {
+               try {
+                       return new Vector<Owner>(DB4oManager.getInstance().getOwners());
+               } catch (Exception e) {
+                       e.printStackTrace();
+               }
+               return null;
+       }
        public void removeHouseAdditionRequests(RuralHouse house) throws RemoteException {
                Administrator.getInstance().getAddRequest().remove(house);
        }
@@@ -67,6 -76,8 +76,6 @@@
  
        }
        
 -
 -      
        public boolean addAccountRequest(String usr,
                        String pss, Owner ow) throws RemoteException {
                
@@@ -5,6 -5,8 +5,8 @@@ import java.rmi.server.UnicastRemoteObj
  import java.util.Date;
  import java.util.Vector;
  
+ import javax.mail.MessagingException;
  import com.db4o.ObjectContainer;
  import com.db4o.ObjectSet;
  import common.BookingInterface;
@@@ -23,8 -25,10 +25,8 @@@ public final class BookingManager exten
         * 
         */
        private static final long serialVersionUID = 1L;
 -      private int bookingNumber = 0;
        dataAccess.DB4oManager dbMngr;
  
 -      private static BookingManager theBookingManager;
  
        public BookingManager() throws RemoteException {
                super();
                }
        }
  
 -      /**
 -       * This method returns the next Booking number
 -       * 
 -       * @return the book number
 -       */
 -
 -    public int getNumber() throws RemoteException{
 -              ObjectContainer db=DB4oManager.getContainer();
 -      BookingManager b=getInstance();
 -      b.bookingNumber++;
 -      db.store(b);
 -      db.commit();
 -      return b.bookingNumber;
 -    }
        
 -      /**
 -       * This method returns the instance of the BookingManager class
 -       * 
 -       * @return the booking manager
 -       * @throws RemoteException 
 -       */
 -
 -      public BookingManager getInstance() throws RemoteException  {
 -              ObjectContainer db=DB4oManager.getContainer();
 -          BookingManager b = new BookingManager();
 -          ObjectSet<BookingManager> result = db.queryByExample(b);
 -          if (!result.hasNext()){
 -              theBookingManager = new BookingManager();
 -              db.store(theBookingManager);
 -              db.commit();
 -          } else theBookingManager=(BookingManager)result.next();
 -              return theBookingManager;
 -      }
  
-       public void removeDenyBooking(Booking b) throws RemoteException{
-                               b.getOffer().getBookings().remove(b);
+       public void denyBooking(Booking b) throws RemoteException{
                                this.dbMngr.removeBooking(b);
        }
  
  
        public void acceptBooking(Booking b) throws RemoteException{
                b.getOffer().setBooked(true);
-               for(Booking boo : b.getOffer().getBookings()){
-                       if(!boo.equals(b))
-                               b.getOffer().getBookings().remove(b);
-               }
+               b.getOffer().getBookings().clear();
+               b.getOffer().getBookings().add(b);
                this.dbMngr.acceptBooking(b.getOffer());
-               /*try {
+               try {
                        MailManager.getInstance().Send(b.getClient().getMailAccount(), "Your booking has been accepted","Here should be the bill");
                } catch (MessagingException e) {
-                       // TODO Auto-generated catch block
                        e.printStackTrace();
-               }*/
+               }
                
        }
        /**
@@@ -13,9 -13,10 +13,9 @@@ import exceptions.OfferCanNotBeBooked
  public interface BookingInterface extends Remote {
  
  
 -      public int getNumber() throws RemoteException;
  
  
-       public void removeDenyBooking(Booking b) throws RemoteException;
+       public void denyBooking(Booking b) throws RemoteException;
  
  
        public void acceptBooking(Booking b) throws RemoteException;
@@@ -81,11 -81,19 +81,19 @@@ public class DB4oManager 
                configuration = Db4oEmbedded.newConfiguration();
                configuration.common().activationDepth(c.getActivationDepth());
                configuration.common().updateDepth(c.getUpdateDepth());
-               configuration.common().objectClass(Owner.class).cascadeOnUpdate(true);
                configuration.common().objectClass(Owner.class).cascadeOnDelete(true);
+               configuration.common().objectClass(Booking.class).cascadeOnDelete(true);
+               configuration.common().objectClass(RuralHouse.class)
+                               .cascadeOnDelete(true);
+               configuration.common().objectClass(Account.class).cascadeOnDelete(true);
+               configuration.common().objectClass(Offer.class).cascadeOnDelete(true);
+               configuration.common().objectClass(Owner.class).cascadeOnUpdate(true);
+               configuration.common().objectClass(Booking.class).cascadeOnUpdate(true);
                configuration.common().objectClass(RuralHouse.class)
                                .cascadeOnUpdate(true);
                configuration.common().objectClass(Account.class).cascadeOnUpdate(true);
+               configuration.common().objectClass(Offer.class).cascadeOnUpdate(true);
+               configuration.common().objectClass(Account.class).cascadeOnUpdate(true);
                db = Db4oEmbedded.openFile(configuration, c.getDb4oFilename());
        }
  
                try {
                        ObjectSet<Offer> of = db.queryByExample(offer);
                        RuralHouse rh = of.get(0).getRuralHouse();
-                       System.out.println(rh.offers.remove(of.get(0)));
+                       System.out.println(rh.getAllOffers().remove(of.get(0)));
                        db.store(rh);
                        db.commit();
  
                }
        }
  
-       public Vector<Offer> getRHsOffer(String name){
+       public Vector<Offer> getRHsOffer(String name) {
                if (c.isDatabaseLocal() == false)
                        openSDB();
                else
                        openDB();
  
                try {
-                       RuralHouse rh = (RuralHouse)db.queryByExample(new RuralHouse(name, null, null, null, null)).get(0);
+                       RuralHouse rh = (RuralHouse) db.queryByExample(
+                                       new RuralHouse(name, null, null, null, null)).get(0);
                        Offer proto = new Offer(0, rh, null, null, 0);
                        ObjectSet<Offer> result = db.queryByExample(proto);
                        return new Vector<Offer>(result);
                        db.close();
                }
        }
-       
-       public Administrator getAdminData(){
+       public Administrator getAdminData() {
  
                if (c.isDatabaseLocal() == false)
                        openSDB();
                                openSDB();
  
                        RuralHouse proto = new RuralHouse(ruralHouse.getHouseName(), null,
 -                                      ruralHouse.getDescription(), ruralHouse.getDistrict(), null);
 +                                      null, null, null);
                        ObjectSet<RuralHouse> result = db.queryByExample(proto);
                        RuralHouse rh = (RuralHouse) result.next();
  
                        Offer offer;
 -                      offer = rh.findOffer(firstDate, lastDate);
 +                      offer = (Offer)db.queryByExample(new Offer(0, rh, firstDate, lastDate, 0)).get(0);
  
                        if (offer != null) {
                                offer.createBooking(theDB4oManagerAux.bookingNumber++, cl);
                }
        }
  
 -      public Vector<RuralHouse> getAllRuralHouses() throws RemoteException,
 -                      Exception {
 -              if (c.isDatabaseLocal() == false)
 -                      openSDB();
 -              else
 -                      openDB();
 -
 -              try {
 -                      RuralHouse proto = new RuralHouse(null, null, null, null, null);
 -                      ObjectSet<RuralHouse> result = db.queryByExample(proto);
 -                      return new Vector<RuralHouse>(result);
 -              } finally {
 -                      db.close();
 -              }
 -      }
        public boolean existsOverlappingOffer(RuralHouse rh, Date firstDay,
                        Date lastDay) throws RemoteException, OverlappingOfferExists {
  
                }
        }
  
 -      public static ObjectContainer getContainer() {
 -              return db;
 -      }
 -
        public void close() {
                db.close();
                System.out.println("DataBase closed");
  
        }
  
-       public Vector<RuralHouse> getRuralHouses(Owner ow, String name, String town,
-                       int nBed, int nKit, int nBath, int nPark, int nLiv) {
+       public Vector<RuralHouse> getRuralHouses(Owner ow, String name,
+                       String town, int nBed, int nKit, int nBath, int nPark, int nLiv) {
                HouseFeatures fea = new HouseFeatures(nBed, nKit, nBath, nLiv, nPark);
                RuralHouse rh = new RuralHouse(name, ow, null, town, fea);
                if (c.isDatabaseLocal() == false)
                return false;
        }
  
-       // TODO remove account
-       public boolean removeAccount(Account acc) {
+       public boolean removeAccount(Owner own) {
                if (c.isDatabaseLocal() == false)
                        openSDB();
                else
                        openDB();
  
                try {
-                       ObjectSet<Account> result = db.queryByExample(new Account(acc
-                                       .getUsername()));
 -                      ObjectSet<Account> result = db.queryByExample(new Account(own));
++                      ObjectSet<Account> result = db.queryByExample(new Account(null,null,own));
                        if (!result.isEmpty()) {
                                db.delete(result.get(0));
-                               ;
                                db.commit();
                                return true;
                        }
                return false;
        }
  
-       // TODO this method should be improved.
        public void acceptBooking(Offer of) {
-               Offer off = new Offer(of.getOfferNumber(), of.getRuralHouse(),
-                               of.getFirstDay(), of.getLastDay(), of.getPrice());
+               Offer off = new Offer(of.getOfferNumber(), new RuralHouse(of
+                               .getRuralHouse().getHouseName(), null, null, null, null), null,
+                               null, 0);
                if (c.isDatabaseLocal() == false)
                        openSDB();
                else
  
                try {
                        ObjectSet<Offer> result = db.queryByExample(off);
-                       this.deleteOffer(result.get(0));
-                       db.store(of);
+                       db.delete(result.get(0));
+                       RuralHouse rh = result.get(0).getRuralHouse();
+                       of.setRuralHouse(rh);
+                       rh.getAllOffers().remove(result.get(0));
+                       rh.getAllOffers().add(of);
+                       db.store(rh);
                        db.close();
  
                } catch (Exception e) {
                else
                        openDB();
                try {
-                       ObjectSet<Booking> result = db.queryByExample(b);
-                       ObjectSet<Client> result2 = db.queryByExample(b.getClient());
-                       db.delete(result.get(0));
-                       db.delete(result2.get(0));
+                       Booking book = new Booking(b.getBookNumber(), new Offer(b
+                                       .getOffer().getOfferNumber(), new RuralHouse(b.getOffer()
+                                       .getRuralHouse().getHouseName(), null, null, null, null),
+                                       null, null, 0), b.getClient(), b.getBookDate());
+                       book.setOffer(null);
+                       db.delete(book);
                        db.commit();
                } catch (Exception e) {
                        e.printStackTrace();
-                       ;
                } finally {
                        db.close();
                }
@@@ -2,9 -2,9 +2,9 @@@ package domain
  
  import java.io.Serializable;
  import java.util.Arrays;
--
  import businessLogic.SecurityManager;
  
++
  public class Account implements Serializable {
  
        /**
        private Owner owner;
        private boolean admin = false;
  
--      
        public Account(byte[] usr){
                this.username = usr;
                this.salt =null;
                this.password = null;
                this.owner = null;
                
 -      }
 -      public Account(Owner own){
 -              this.username = null;
 -              this.salt =null;
 -              this.password = null;
 -              this.owner = own;
 -              
        }
        public Account(String usr, String pass, boolean isAdmin) {
                this.username = SecurityManager.getInstance().calculateHash(usr);
@@@ -48,7 -55,7 +47,9 @@@
  
        }
  
++
        
++
        public byte[] getUsername() {
                return username;
        }
@@@ -55,6 -55,6 +55,7 @@@ public class Administrator implements S
                }
        }
  
++      
        public LinkedList<RuralHouse> getAddRequest() {
                return addRequest;
        }
@@@ -3,7 -3,7 +3,7 @@@ package domain
  import java.io.Serializable;
  import java.util.Date;
  
 -public class Booking implements Serializable {
 +public class Booking implements Serializable  {
  
        /**
         * 
        private Date bookingDate;
        private Client client;
        private Offer offer;
 -
 -      public Booking(int bN, Offer offer, Client client, Date date) {
 +      
 +      
 +      
 +      public Booking(int bN , Offer offer,Client client) {
 +              
                this.bookingNumber = bN;
                this.offer = offer;
 -              this.client = client;
 -              // Booking date is assigned to actual date
 -              this.bookingDate = date;
 +              this.client=client;
 +              //Booking date is assigned to actual date
 +              this.bookingDate= new java.util.Date(System.currentTimeMillis());
        }
 +      
  
 -      public Booking(int bN, Offer offer, Client client) {
 -
++      public Booking(int bN , Offer offer,Client client, Date bookDate) {
+               this.bookingNumber = bN;
+               this.offer = offer;
 -              this.client = client;
 -              // Booking date is assigned to actual date
 -              this.bookingDate = new java.util.Date(System.currentTimeMillis());
 -      }
++              this.client=client;
++              this.bookingDate= bookDate;     }
 -      public void imprimete() {
 -              System.out.println(bookingNumber);
 -              System.out.println(bookingDate);
 -              System.out.println(client.toString());
 -              System.out.println(offer);
 -      }
        public int getBookNumber() {
                return this.bookingNumber;
        }
@@@ -38,6 -50,9 +45,6 @@@
                return this.offer;
        }
  
 -      public float getPrice() {
 -              return this.offer.getPrice();
 -      }
  
        public void setBookDate(Date bookDate) {
                this.bookingDate = bookDate;
@@@ -46,7 -61,7 +53,7 @@@
        public Date getBookDate() {
                return this.bookingDate;
        }
 -
 +      
        public Client getClient() {
                return client;
        }
@@@ -54,5 -69,5 +61,5 @@@
        public void setClient(Client client) {
                this.client = client;
        }
 -
 +      
  }
@@@ -1,7 -1,13 +1,13 @@@
  package domain;
  
- public class Client {
+ import java.io.Serializable;
  
 -public class Client implements Serializable{
++public class Client  implements Serializable{
+       /**
+        * 
+        */
+       private static final long serialVersionUID = 1L;
        private String name;
        private String mailAccount;
        private String telephone;
@@@ -14,10 -14,10 +14,6 @@@ public class Owner implements Serializa
        private String mailAccount = "";
        private Vector<RuralHouse> ruralHouses;
  
--//    public Owner(String name) {
--//            this.name = name;
--//            ruralHouses = new hVector<RuralHouse>();
--//    }
  
        public Owner(String name, String bankAccount,String mail) {
                this.bankAccount = bankAccount;
@@@ -14,8 -14,10 +14,9 @@@ public class RuralHouse implements Seri
        private Owner owner;
        private String district;
        private HouseFeatures features;
 -      private Vector<Offer> offers;
 -      private boolean isAccepted;
 +      public Vector<Offer> offers;
  
        public RuralHouse() {
                super();
        }
                return true;
        }
  
 -      /**
 -       * This method obtains available offers for a concrete house in a certain
 -       * period
 -       * 
 -       * @param houseName
 -       *            , the house number where the offers must be obtained
 -       * @param firstDay
 -       *            , first day in a period range
 -       * @param lastDay
 -       *            , last day in a period range
 -       * @return a vector of offers(Offer class) available in this period
 -       */
 -      public Vector<Offer> getOffers(Date firstDay, Date lastDay) {
 -              Vector<Offer> availableOffers = new Vector<Offer>();
 -              Iterator<Offer> e = offers.iterator();
 -              Offer offer;
 -              while (e.hasNext()) {
 -                      offer = e.next();
 -                      if ((offer.getFirstDay().compareTo(firstDay) >= 0)
 -                                      && (offer.getLastDay().compareTo(lastDay) <= 0)
 -                                      && (!offer.isBooked()))
 -                              availableOffers.add(offer);
 -              }
 -              return availableOffers;
 -      }
  
 -      public Vector<Offer> getAllOffers() {
 -
 -              return this.offers;
 -      }
 -
 -      /**
 -       * This method obtains the offer that match exactly with a given dates that
 -       * has not been booked
 -       * 
 -       * @param firstDay
 -       *            , first day in a period range
 -       * @param lastDay
 -       *            , last day in a period range
 -       * @return the offer(Offer class) available for a this period
 -       */
 -      public Offer findOffer(Date firstDay, Date lastDay) {
 -              Iterator<Offer> e = offers.iterator();
 -              Offer offer = null;
 -              while (e.hasNext()) {
 -                      offer = e.next();
 -                      if ((offer.getFirstDay().compareTo(firstDay) == 0)
 -                                      && (offer.getLastDay().compareTo(lastDay) == 0)
 -                                      && (!offer.isBooked()))
 -                              return offer;
 -              }
 -              return null;
 -      }
  
        public Offer overlapsWith(Date firstDay, Date lastDay) {
  
                return null;
  
        }
 +      
  
 -      public boolean isAccepted() {
 -              return isAccepted;
 -      }
 +      public Vector<Offer> getAllOffers() {
  
 -      public void setAccepted(boolean isAccepted) {
 -              this.isAccepted = isAccepted;
 +              return this.offers;
        }
  
++
  }
index eef2ba4,0000000..24dcb27
mode 100644,000000..100644
--- /dev/null
@@@ -1,84 -1,0 +1,76 @@@
- import javax.swing.GroupLayout;
- import javax.swing.GroupLayout.Alignment;
 +package gui;
 +
 +import java.awt.Frame;
 +import java.awt.event.ActionEvent;
 +import java.awt.event.ActionListener;
 +
-               setBounds(100, 100, 450, 473);
 +import javax.swing.JButton;
 +import javax.swing.JFrame;
 +import javax.swing.JPanel;
 +import javax.swing.border.EmptyBorder;
 +
 +public class AdminMenuGUI extends JFrame {
 +
 +      /**
 +       * 
 +       */
 +      private static final long serialVersionUID = 1L;
 +      private JPanel contentPane;
 +
 +
 +      
 +      /**
 +       * Create the frame.
 +       */
 +      public AdminMenuGUI() {
 +              
 +              
 +              this.setTitle("Administrator Menu");
 +              this.getContentPane().setLayout(null);
-               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.TRAILING, false)
-                                               .addComponent(btnOwneraddition, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
-                                               .addComponent(btnDel, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 164, Short.MAX_VALUE)
-                                               .addComponent(btnAdd, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 164, Short.MAX_VALUE))
-                                       .addContainerGap(145, Short.MAX_VALUE))
-               );
-               gl_contentPane.setVerticalGroup(
-                       gl_contentPane.createParallelGroup(Alignment.LEADING)
-                               .addGroup(gl_contentPane.createSequentialGroup()
-                                       .addGap(62)
-                                       .addComponent(btnAdd, GroupLayout.PREFERRED_SIZE, 81, GroupLayout.PREFERRED_SIZE)
-                                       .addGap(58)
-                                       .addComponent(btnDel, GroupLayout.PREFERRED_SIZE, 81, GroupLayout.PREFERRED_SIZE)
-                                       .addGap(52)
-                                       .addComponent(btnOwneraddition, GroupLayout.DEFAULT_SIZE, 79, Short.MAX_VALUE)
-                                       .addContainerGap())
-               );
-               contentPane.setLayout(gl_contentPane);
++              setBounds(100, 100, 450, 500);
 +              contentPane = new JPanel();
 +              contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
 +              setContentPane(contentPane);
 +              //TODO BOTH BUTTONS ARE TO MODIFY
 +              JButton btnAdd = new JButton("Add requests");
++              btnAdd.setBounds(120, 67, 164, 81);
 +              btnAdd.addActionListener(new ActionListener() {
 +                      public void actionPerformed(ActionEvent e) {
 +                              Frame a = new listOfAdditionRequestsGUI();
 +                              a.setVisible(true);
 +                      }
 +              });
 +              
 +              JButton btnDel = new JButton("Delete Requests");
++              btnDel.setBounds(120, 159, 164, 73);
 +              btnDel.addActionListener(new ActionListener() {
 +                      public void actionPerformed(ActionEvent e) {
 +                              Frame a = new listOfRemovalRequestsGUI();
 +                              a.setVisible(true);
 +                      }
 +              });
 +              
 +              JButton btnOwneraddition = new JButton("OwnerAddition");
++              btnOwneraddition.setBounds(120, 243, 164, 73);
 +              btnOwneraddition.addActionListener(new ActionListener() {
 +                      public void actionPerformed(ActionEvent e) {
 +                              Frame a = new listOfOwnerAddittionRequests();
 +                              a.setVisible(true);
 +                      }
 +              });
++              contentPane.setLayout(null);
++              contentPane.add(btnOwneraddition);
++              contentPane.add(btnDel);
++              contentPane.add(btnAdd);
++      
++              JButton btnOwnerDeletion = new JButton("Owner Deletion");
++              btnOwnerDeletion.setBounds(120, 331, 164, 73);
++              btnOwnerDeletion.addActionListener(new ActionListener() {
++                      public void actionPerformed(ActionEvent e) {
++                              Frame a = new DeleteOwnerGUI();
++                              a.setVisible(true);
++                      }
++              });
++              contentPane.add(btnOwnerDeletion);
 +      }
 +}
index c26d9df,0000000..21f9ab6
mode 100644,000000..100644
--- /dev/null
@@@ -1,102 -1,0 +1,103 @@@
-     jTextField3.setText(Float.toString(book.getOffer().getPrice()) + " ï¿½");
 +package gui;
 +
 +import java.awt.Dimension;
 +import java.awt.Rectangle;
 +import java.awt.event.ActionEvent;
 +import java.awt.event.ActionListener;
 +
 +import javax.swing.JButton;
 +import javax.swing.JFrame;
 +import javax.swing.JLabel;
 +import javax.swing.JTextField;
 +
 +import domain.Booking;
 +
 +public class BookRuralHouseConfirmationWindow extends JFrame {
 + private static final long serialVersionUID = 1L;
 +      
 +  private JLabel jLabel1 = new JLabel();
 +  private JTextField jTextField1 = new JTextField();
 +  private JLabel jLabel2 = new JLabel();
 +  private JTextField jTextField2 = new JTextField();
 +  private JLabel jLabel3 = new JLabel();
 +  private JButton jButton1 = new JButton();
 +  private JLabel jLabel4 = new JLabel();
 +  private JLabel jLabel5 = new JLabel();
 +  private JTextField jTextField3 = new JTextField();
 +  private JTextField jTextField4 = new JTextField();
 +
 +  public BookRuralHouseConfirmationWindow(Booking book)
 +  {
 +    try
 +    {
 +      jbInit(book);
 +    }
 +    catch(Exception e)
 +    {
 +      e.printStackTrace();
 +    }
 +
 +  }
 +
 +  private void jbInit(Booking book) throws Exception
 +  {
 +        
 +
 +    this.getContentPane().setLayout(null);
 +    this.setSize(new Dimension(416, 316));
 +    this.setTitle("See Booking Details");
 +    this.setResizable(false);
 +    jLabel1.setText("Owner Bank account number:");
 +    jLabel1.setBounds(new Rectangle(20, 20, 200, 25));
 +    jTextField1.setBounds(new Rectangle(225, 20, 165, 25));
 +    jTextField1.setEditable(false);
 +
 +    jTextField1.setText(book.getOffer().getRuralHouse().getOwner().getBankAccount());
 +    
 +    jLabel2.setText("Booking number:");
 +    jLabel2.setBounds(new Rectangle(20, 60, 130, 25));
 +    jTextField2.setBounds(new Rectangle(225, 60, 165, 25));
 +    jTextField2.setEditable(false);
 +
 +    jTextField2.setText(Integer.toString(book.getBookNumber()));
 +    
 +    jLabel3.setText("You must deposit 20% of the total ammount of a book in the next three days.");
 +    jLabel3.setBounds(new Rectangle(20, 105, 370, 25));
 +    jButton1.setText("Close");
 +    jButton1.setBounds(new Rectangle(135, 235, 130, 30));
 +    jButton1.addActionListener(new ActionListener()
 +      {
 +        public void actionPerformed(ActionEvent e)
 +        {
 +          jButton1_actionPerformed(e);
 +        }
 +      });
 +    jLabel4.setText("Total:");
 +    jLabel4.setBounds(new Rectangle(70, 140, 85, 25));
 +    jLabel5.setText("Deposit ammount:");
 +    jLabel5.setBounds(new Rectangle(70, 175, 100, 25));
 +    jTextField3.setBounds(new Rectangle(180, 140, 115, 25));
 +    jTextField3.setEditable(false);
 +
-     jTextField4.setText(Float.toString(book.getOffer().getPrice()*(float)0.2) + " ï¿½");
++    jTextField3.setText(Float.toString(book.getOffer().getPrice()) + " \80");
 +    jTextField4.setBounds(new Rectangle(180, 175, 115, 25));
 +    jTextField4.setEditable(false);
++    jTextField4.setText(Float.toString(book.getOffer().getPrice()*(float)0.2) + " \80");
++
 +    this.getContentPane().add(jTextField4, null);
 +    this.getContentPane().add(jTextField3, null);
 +    this.getContentPane().add(jLabel5, null);
 +    this.getContentPane().add(jLabel4, null);
 +    this.getContentPane().add(jButton1, null);
 +    this.getContentPane().add(jLabel3, null);
 +    this.getContentPane().add(jTextField2, null);
 +    this.getContentPane().add(jLabel2, null);
 +    this.getContentPane().add(jTextField1, null);
 +    this.getContentPane().add(jLabel1, null);
 +  }
 +
 +  private void jButton1_actionPerformed(ActionEvent e)
 +  {
 +    this.setVisible(false);
 +  }
 +}
index d3a79e4,0000000..d9f5ab8
mode 100644,000000..100644
--- /dev/null
@@@ -1,145 -1,0 +1,159 @@@
-       private Owner owner;
 +package gui;
 +
 +import java.awt.event.ActionEvent;
 +import java.awt.event.ActionListener;
 +import java.awt.event.ItemEvent;
 +import java.awt.event.ItemListener;
 +import java.rmi.Naming;
++import java.rmi.RemoteException;
 +import java.util.Vector;
 +
 +import javax.swing.JButton;
 +import javax.swing.JComboBox;
 +import javax.swing.JFrame;
 +import javax.swing.JLabel;
 +import javax.swing.JPanel;
 +import javax.swing.JRadioButton;
 +import javax.swing.border.EmptyBorder;
 +
++import common.HouseInterface;
 +import common.OfferInterface;
 +
 +import configuration.___IntNames;
 +import domain.Offer;
 +import domain.Owner;
 +import domain.RuralHouse;
 +
 +public class DeleteOfferGUI extends JFrame {
 +
 +      /**
 +       * 
 +       */
 +      private static final long serialVersionUID = 1L;
 +      private JPanel contentPane;
-               this.owner = o;
 +      private JLabel feedback;
 +      private JComboBox<RuralHouse> comboBox;
 +      private JComboBox<Offer> comboBox_1;
 +      private JButton btnDelete;
++      private Vector<RuralHouse> Hlist = null;
++      private HouseInterface hm = null;
 +
 +      /**
 +       * Create the frame.
 +       */
 +      public DeleteOfferGUI(Owner o) {
-               comboBox = new JComboBox<RuralHouse>(this.owner.getRuralHouses());
++              try {
++                      hm = (HouseInterface) Naming
++                                      .lookup(___IntNames.HouseManager);
++              } catch (Exception e1) {
++                      System.out.println("Error accessing remote authentication: "
++                                      + e1.toString());
++              }
++              try {
++                      Hlist = hm.getHouses(o, null, null, 0, 0, 0, 0, 0);
++              } catch (RemoteException e1) {
++                      e1.printStackTrace();
++              }       
 +              setBounds(100, 100, 450, 300);
 +              contentPane = new JPanel();
 +              contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
 +              setContentPane(contentPane);
 +
-               Vector<Offer> vo = ((RuralHouse) comboBox.getSelectedItem()).offers;
++              comboBox = new JComboBox<RuralHouse>(this.Hlist);
 +              comboBox.setBounds(101, 38, 314, 20);
 +
 +              comboBox_1 = new JComboBox<Offer>();
 +              comboBox_1.setBounds(101, 76, 314, 20);
-                               Vector<Offer> vo = ((RuralHouse) comboBox.getSelectedItem()).offers;
++              Vector<Offer> vo = ((RuralHouse) comboBox.getSelectedItem()).getAllOffers();
 +              comboBox_1.removeAllItems();
 +              for (Offer of : vo) {
 +                      comboBox_1.addItem(of);
 +                      ;
 +              }
 +
 +              JRadioButton rdbtnIAmSure = new JRadioButton("I am sure");
 +              rdbtnIAmSure.setBounds(101, 134, 108, 23);
 +
 +              btnDelete = new JButton("DELETE");
 +              btnDelete.setBounds(92, 226, 117, 23);
 +              btnDelete.setEnabled(false);
 +
 +              comboBox.addItemListener(new ItemListener() {
 +
 +                      @Override
 +                      public void itemStateChanged(ItemEvent arg0) {
++                              Vector<Offer> vo = ((RuralHouse) comboBox.getSelectedItem()).getAllOffers();
 +                              comboBox_1.removeAllItems();
 +                              for (Offer of : vo) {
 +                                      comboBox_1.addItem(of);
 +                                      ;
 +                              }
 +
 +                      }
 +
 +              });
 +
 +              rdbtnIAmSure.addItemListener(new ItemListener() {
 +
 +                      @Override
 +                      public void itemStateChanged(ItemEvent e) {
 +                              int state = e.getStateChange();
 +                              if (state == ItemEvent.SELECTED) {
 +                                      if (comboBox_1.getSelectedItem() != null)
 +                                              btnDelete.setEnabled(true);
 +                              } else if (state == ItemEvent.DESELECTED) {
 +                                      btnDelete.setEnabled(false);
 +                              }
 +                      }
 +              });
 +
 +              JLabel lblHouse = new JLabel("House:");
 +              lblHouse.setBounds(25, 41, 68, 14);
 +
 +              JLabel lblOffer = new JLabel("Offer:");
 +              lblOffer.setBounds(25, 79, 68, 14);
 +              contentPane.setLayout(null);
 +              contentPane.add(btnDelete);
 +              contentPane.add(rdbtnIAmSure);
 +              contentPane.add(lblHouse);
 +              contentPane.add(lblOffer);
 +              contentPane.add(comboBox);
 +              contentPane.add(comboBox_1);
 +              
 +              feedback = new JLabel("");
 +              feedback.setBounds(140, 178, 202, 23);
 +              contentPane.add(feedback);
 +
 +              btnDelete.addActionListener(new ActionListener() {
 +                      public void actionPerformed(ActionEvent arg0) {
 +                              actionListenerButton(arg0);
 +
 +                      }
 +
 +              });
 +      }
 +
 +      private void actionListenerButton(ActionEvent e) {
 +
 +              Offer toDel = (Offer) comboBox_1.getSelectedItem();
 +              OfferInterface oM = null;
 +              try {
 +                      oM = (OfferInterface) Naming
 +                                      .lookup(___IntNames.OfferManager);
 +              } catch (Exception e1) {
 +                      System.out.println("Error accessing remote authentication: "
 +                                      + e1.toString());
 +              }
 +              
 +              try {
 +                      oM.deleteOffer((RuralHouse) comboBox.getSelectedItem(), toDel);
 +                      comboBox_1.removeItem(toDel);
 +                      btnDelete.setEnabled(false);
 +                      feedback.setText("Offer correctly deleted");
 +              } catch (Exception e1) {
 +                      feedback.setText("Imposible to delete the offer");
 +                      e1.printStackTrace();
 +              }
 +              
 +      }
 +}
index 0000000,0000000..982e022
new file mode 100644 (file)
--- /dev/null
--- /dev/null
@@@ -1,0 -1,0 +1,139 @@@
++package gui;
++
++import java.awt.Font;
++import java.awt.Rectangle;
++import java.awt.event.ActionEvent;
++import java.awt.event.ActionListener;
++import java.rmi.Naming;
++import java.rmi.RemoteException;
++import java.util.Enumeration;
++import java.util.Vector;
++
++import javax.swing.JButton;
++import javax.swing.JFrame;
++import javax.swing.JLabel;
++import javax.swing.JPanel;
++import javax.swing.JScrollPane;
++import javax.swing.JTable;
++import javax.swing.border.EmptyBorder;
++import javax.swing.table.DefaultTableModel;
++
++import common.AccountInterface;
++import common.AdminInterface;
++
++import configuration.___IntNames;
++import domain.Owner;
++
++public class DeleteOwnerGUI extends JFrame {
++
++      /**
++       * 
++       */
++      private static final long serialVersionUID = 1L;
++      private JPanel contentPane;
++      private JTable table;
++
++      private DefaultTableModel tableModel;
++      private AdminInterface AdM = null;
++      private Vector<Owner> owners = new Vector<Owner>();
++
++      /**
++       * Create the frame.
++       */
++      public DeleteOwnerGUI() {
++              setTitle("Current owners:");
++              try {
++                      init();
++              } catch (Exception e) {
++                      e.printStackTrace();
++              }
++      }
++
++      private void init() throws Exception {
++              setBounds(100, 100, 600, 500);
++              contentPane = new JPanel();
++              contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
++              setContentPane(contentPane);
++              contentPane.setLayout(null);
++              try {
++                      AdM = (AdminInterface) Naming
++                                      .lookup(___IntNames.AdminManager);
++              } catch (Exception e1) {
++                      System.out
++                                      .println("Error accessing remote authentication: "
++                                                      + e1.toString());
++              }
++              this.owners = AdM.getAllOwners();
++              JLabel lblNewLabel = new JLabel();
++              lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 27));
++              lblNewLabel.setBounds(23, 41, 536, 33);
++              contentPane.add(lblNewLabel);
++              if (this.owners.isEmpty())
++                      lblNewLabel
++                                      .setText("There are not owners in the system");
++              else
++                      lblNewLabel.setText("List of owners:");
++              JScrollPane scrollPane = new JScrollPane();
++              scrollPane.setBounds(new Rectangle(45, 305, 320, 116));
++              scrollPane.setBounds(23, 113, 536, 271);
++              contentPane.add(scrollPane);
++              final JLabel feedback = new JLabel("");
++              feedback.setBounds(134, 447, 307, 14);
++              contentPane.add(feedback);
++              JButton btnNewButton = new JButton("Delete from the system");
++              btnNewButton.addActionListener(new ActionListener() {
++                      public void actionPerformed(ActionEvent e) {
++                              if (table.getRowCount()!=0 && table.getSelectedRow() != -1) {
++                                      AccountInterface acm = null;
++                                      
++                                      try {
++                                              acm = (AccountInterface) Naming
++                                                              .lookup(___IntNames.AccountManager);
++                                      } catch (Exception e1) {
++                                              System.out.println("Error accessing remote authentication: "
++                                                              + e1.toString());
++                                      }
++
++                                      try {
++                                              if(acm.removeAccount(table.getSelectedRow()))
++                                                      {
++                                                      feedback.setText("Deleted from the system");
++                                                      }
++                                      } catch (RemoteException e1) {
++                                              e1.printStackTrace();
++                                      }
++                                      
++                                      ((DefaultTableModel)table.getModel()).removeRow(table.getSelectedRow());
++                              }
++                      }
++              });
++              btnNewButton.setBounds(88, 396, 428, 40);
++              contentPane.add(btnNewButton);
++              table = new JTable() {
++                      private static final long serialVersionUID = 1L;
++
++                      public boolean isCellEditable(int row, int column) {
++                              return false;
++                      };
++              };
++              
++              scrollPane.setViewportView(table);      
++              tableModel = new DefaultTableModel(null, new String[] {
++                              "Name", "E-mail", "Bank Account" });
++
++              table.setModel(tableModel);
++              
++              
++              Enumeration<Owner> rhs = this.owners.elements();
++              while (rhs.hasMoreElements()) {
++                      Owner own = rhs.nextElement();
++                      Vector<Object> row = new Vector<Object>();
++                      row.add(own.getName());
++                      row.add(own.getMailAccount());
++                      row.add(own.getBankAccount());
++                      tableModel.addRow(row);
++              }
++              
++              
++      }
++}
index 62e81e9,0000000..39d0bc9
mode 100644,000000..100644
--- /dev/null
@@@ -1,319 -1,0 +1,322 @@@
-                       if (of.getBookings() != null) {
 +package gui;
 +
 +import java.awt.Color;
 +import java.awt.Component;
 +import java.awt.event.ActionEvent;
 +import java.awt.event.ActionListener;
 +import java.awt.event.MouseAdapter;
 +import java.awt.event.MouseEvent;
 +import java.rmi.Naming;
 +import java.util.Date;
 +import java.util.Enumeration;
 +import java.util.Vector;
 +
 +import javax.swing.JButton;
 +import javax.swing.JFrame;
 +import javax.swing.JLabel;
 +import javax.swing.JPanel;
 +import javax.swing.JScrollPane;
 +import javax.swing.JTable;
 +import javax.swing.JTextField;
 +import javax.swing.SwingConstants;
 +import javax.swing.border.EmptyBorder;
 +import javax.swing.table.DefaultTableCellRenderer;
 +import javax.swing.table.DefaultTableModel;
 +
 +import common.BookingInterface;
 +
 +import configuration.___IntNames;
 +import domain.Booking;
 +import domain.Client;
 +import domain.Offer;
 +import domain.RuralHouse;
 +
 +public class HouseFeaturesGUI extends JFrame {
 +
 +      /**
 +       * 
 +       */
 +      private static final long serialVersionUID = 1L;
 +      private JPanel contentPane;
 +      private JLabel lblDistrict;
 +      private JTextField District_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 JTable table;
 +      private DefaultTableModel tableModel;
 +      private RuralHouse rh;
++      private Vector<Offer> offers= new Vector<Offer>();
 +      private JTextField telIn;
 +      private int row;
 +      private JLabel labelPhone;
 +      private JLabel lblName;
 +      private JTextField nameField;
 +      private JLabel lblEmail;
 +      private JTextField mailField;
 +
 +      /**
 +       * Create the frame.
 +       */
 +
 +      public HouseFeaturesGUI(RuralHouse RH, final Date FirstDay,
 +                      final Date LastDay) {
 +              this.rh = RH;
 +              this.getContentPane().setLayout(null);
 +              setBounds(100, 100, 500, 700);
 +              contentPane = new JPanel();
 +              contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
 +              setContentPane(contentPane);
 +
 +              lblDistrict = new JLabel("District:");
 +              lblDistrict.setBounds(23, 67, 70, 14);
 +              lblDistrict.setHorizontalAlignment(SwingConstants.RIGHT);
 +
 +              District_f = new JTextField();
 +              District_f.setEditable(false);
 +              District_f.setBounds(103, 64, 86, 20);
 +              District_f.setColumns(10);
 +
 +              lblDescription = new JLabel("Description:");
 +              lblDescription.setBounds(215, 67, 90, 14);
 +              lblDescription.setHorizontalAlignment(SwingConstants.RIGHT);
 +
 +              description_f = new JTextField();
 +              description_f.setEditable(false);
 +              description_f.setBounds(238, 99, 178, 129);
 +              description_f.setColumns(10);
 +
 +              lblKitchen = new JLabel("Kitchens:");
 +              lblKitchen.setBounds(23, 211, 70, 14);
 +              lblKitchen.setHorizontalAlignment(SwingConstants.RIGHT);
 +
 +              kitchens_f = new JTextField();
 +              kitchens_f.setEditable(false);
 +              kitchens_f.setBounds(103, 202, 86, 20);
 +              kitchens_f.setColumns(10);
 +
 +              lblRooms = new JLabel("Rooms:");
 +              lblRooms.setBounds(23, 102, 70, 14);
 +              lblRooms.setHorizontalAlignment(SwingConstants.RIGHT);
 +
 +              rooms_f = new JTextField();
 +              rooms_f.setEditable(false);
 +              rooms_f.setBounds(103, 99, 86, 20);
 +              rooms_f.setColumns(10);
 +
 +              lblLivings = new JLabel("Living rooms:");
 +              lblLivings.setBounds(30, 236, 63, 14);
 +              lblLivings.setHorizontalAlignment(SwingConstants.RIGHT);
 +
 +              lRooms_f = new JTextField();
 +              lRooms_f.setEditable(false);
 +              lRooms_f.setBounds(103, 233, 86, 20);
 +              lRooms_f.setColumns(10);
 +
 +              lblParkings = new JLabel("Parkings:");
 +              lblParkings.setBounds(23, 174, 70, 14);
 +              lblParkings.setHorizontalAlignment(SwingConstants.RIGHT);
 +
 +              parkings_f = new JTextField();
 +              parkings_f.setEditable(false);
 +              parkings_f.setBounds(103, 171, 86, 20);
 +              parkings_f.setColumns(10);
 +
 +              lblBaths = new JLabel("Baths:");
 +              lblBaths.setBounds(23, 143, 70, 14);
 +              lblBaths.setHorizontalAlignment(SwingConstants.RIGHT);
 +
 +              baths_f = new JTextField();
 +              baths_f.setEditable(false);
 +              baths_f.setBounds(103, 140, 86, 20);
 +              baths_f.setColumns(10);
 +              contentPane.setLayout(null);
 +              contentPane.add(lblParkings);
 +              contentPane.add(parkings_f);
 +              contentPane.add(lblRooms);
 +              contentPane.add(rooms_f);
 +              contentPane.add(lblBaths);
 +              contentPane.add(baths_f);
 +              contentPane.add(lblDistrict);
 +              contentPane.add(District_f);
 +              contentPane.add(lblLivings);
 +              contentPane.add(lRooms_f);
 +              contentPane.add(lblKitchen);
 +              contentPane.add(kitchens_f);
 +              contentPane.add(description_f);
 +              contentPane.add(lblDescription);
 +              parkings_f.setText(Integer.toString(rh.getFeatures().getnParkings()));
 +              rooms_f.setText(Integer.toString(rh.getFeatures().getnRooms()));
 +              baths_f.setText(Integer.toString(rh.getFeatures().getnBaths()));
 +              District_f.setText(rh.getDistrict());
 +              kitchens_f.setText(Integer.toString(rh.getFeatures().getnKitchens()));
 +              description_f.setText(rh.getDescription());
 +              lRooms_f.setText(Integer.toString(rh.getFeatures().getnLivings()));
 +              JLabel lblAvailbleOffers = new JLabel("Availble Offers:");
 +              lblAvailbleOffers.setBounds(30, 286, 86, 14);
 +              contentPane.add(lblAvailbleOffers);
 +              JScrollPane scrollPane = new JScrollPane();
 +              scrollPane.setBounds(40, 311, 376, 183);
 +              contentPane.add(scrollPane);
 +
 +              table = new JTable() {
 +                      private static final long serialVersionUID = 1L;
 +
 +                      public boolean isCellEditable(int row, int column) {
 +                              return false;
 +                      };
 +              };
 +              tableModel = new DefaultTableModel(null, new String[] { "Offer #",
 +                              "FirstDay", "LastDay", "Price" });
 +              table.setModel(tableModel);
 +              scrollPane.setViewportView(table);
 +
 +              JButton btnBookSelected = new JButton("Book SelectedOffer");
 +              btnBookSelected.setBounds(238, 614, 178, 23);
 +              contentPane.add(btnBookSelected);
 +
 +              btnBookSelected.addActionListener(new ActionListener() {
 +                      public void actionPerformed(ActionEvent arg0) {
 +
 +                              jButton_ActionPerformed(arg0);
 +                      }
 +
 +              });
 +
 +              JLabel lblNewLabel = new JLabel(
 +                              "Green: Suit your dates. Red: Do not suit your dates");
 +              lblNewLabel.setEnabled(false);
 +              lblNewLabel.setBounds(170, 282, 261, 23);
 +              contentPane.add(lblNewLabel);
 +
 +              JLabel lblNewLabel_1 = new JLabel("Telephone num:");
 +              lblNewLabel_1.setBounds(10, 618, 83, 14);
 +              contentPane.add(lblNewLabel_1);
 +
 +              telIn = new JTextField();
 +              telIn.setBounds(103, 615, 129, 20);
 +              contentPane.add(telIn);
 +              telIn.setColumns(10);
 +
 +              labelPhone = new JLabel("");
 +              labelPhone.setBounds(238, 252, 178, 14);
 +              contentPane.add(labelPhone);
 +
 +              lblName = new JLabel("Name:");
 +              lblName.setBounds(10, 516, 46, 14);
 +              contentPane.add(lblName);
 +
 +              nameField = new JTextField();
 +              nameField.setBounds(103, 513, 178, 20);
 +              contentPane.add(nameField);
 +              nameField.setColumns(10);
 +
 +              lblEmail = new JLabel("E-mail:");
 +              lblEmail.setBounds(10, 565, 46, 14);
 +              contentPane.add(lblEmail);
 +
 +              mailField = new JTextField();
 +              mailField.setBounds(103, 562, 178, 20);
 +              contentPane.add(mailField);
 +              mailField.setColumns(10);
 +
 +              table.addMouseListener(new MouseAdapter() {
 +                      @Override
 +                      public void mouseClicked(MouseEvent arg0) {
 +                              row = table.getSelectedRow();
 +                      }
 +              });
 +              
 +              Enumeration<Offer> rhs = rh.getAllOffers().elements();
 +              while (rhs.hasMoreElements()) {
 +                      Offer of = rhs.nextElement();
-                                       book = bookingM.createBooking(rh, rh.offers.get(row)
-                                                       .getFirstDay(), rh.offers.get(row).getLastDay(),cl);
++                      if (of.getBookings() == null
++                                      || !of.isBooked()) {
++                              offers.add(of);
 +                              Vector<Object> row = new Vector<Object>();
 +                              row.add(of.getOfferNumber());
 +                              row.add(of.getFirstDay());
 +                              row.add(of.getLastDay());
 +                              row.add(of.getPrice());
 +                              tableModel.addRow(row);
 +                      }
 +              }
 +              table.setDefaultRenderer(Object.class, new DefaultTableCellRenderer() {
 +                      /**
 +                       * 
 +                       */
 +                      private static final long serialVersionUID = 1L;
 +
 +                      @Override
 +                      public Component getTableCellRendererComponent(JTable table,
 +                                      Object value, boolean isSelected, boolean hasFocus,
 +                                      int row, int col) {
 +
 +                              super.getTableCellRendererComponent(table, value, isSelected,
 +                                              hasFocus, row, col);
 +
 +                              Date firstDay = (Date) table.getModel().getValueAt(row, 1);
 +                              Date lastDay = (Date) table.getModel().getValueAt(row, 2);
 +                              if (FirstDay != null && LastDay != null) {
 +                                      if (LastDay.before(lastDay) || FirstDay.after(firstDay)) {
 +                                              setBackground(Color.RED);
 +                                              setForeground(Color.BLACK);
 +                                      } else {
 +                                              setBackground(Color.GREEN);
 +                                              setForeground(Color.BLACK);
 +                                      }
 +                              }
 +                              return this;
 +                      }
 +              });
 +      }
 +
 +      private void jButton_ActionPerformed(ActionEvent arg0) {
 +
 +              BookingInterface bookingM = null;
 +              try {
 +                      bookingM = (BookingInterface) Naming
 +                                      .lookup(___IntNames.BookingManager);
 +              } catch (Exception e1) {
 +                      System.out.println("Error accessing remote authentication: "
 +                                      + e1.toString());
 +              }
 +              
 +              if (telIn.getText().matches("[976]\\d{2}[.\\- ]?\\d{3}[.\\- ]?\\d{3}")
 +                              && mailField
 +                              .getText()
 +                              .matches(
 +                                              "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$")
 +              && !nameField.getText().isEmpty()) {
 +                      labelPhone.setText("");
 +                      Vector<Booking> book = null;
 +                      try {
 +                              if (table.getRowCount() != 0) {
 +                                      Client cl = new Client(nameField.getText(),
 +                                                      mailField.getText(), telIn.getText());
++                                      book = bookingM.createBooking(rh, offers.get(row)
++                                                      .getFirstDay(), offers.get(row).getLastDay(),cl);
 +                              }
 +                      } catch (Exception e) {
 +                              e.printStackTrace();
 +                      }
 +                      if (book != null) {
 +                              BookRuralHouseConfirmationWindow confirmWindow = new BookRuralHouseConfirmationWindow(
 +                                              book.lastElement());
 +                              confirmWindow.setVisible(true);
 +                      }
 +              } else {
 +                      labelPhone.setText("Bad formatted data.");
 +
 +              }
 +      }
 +}
index 691b0ca,0000000..d5db84c
mode 100644,000000..100644
--- /dev/null
@@@ -1,236 -1,0 +1,237 @@@
 +package gui;
 +
 +import java.awt.event.ActionEvent;
 +import java.awt.event.ActionListener;
 +import java.awt.event.ItemEvent;
 +import java.awt.event.ItemListener;
 +import java.rmi.Naming;
 +import java.rmi.RemoteException;
 +import java.util.Vector;
 +
 +import javax.swing.DefaultComboBoxModel;
 +import javax.swing.JButton;
 +import javax.swing.JComboBox;
 +import javax.swing.JFrame;
 +import javax.swing.JLabel;
 +import javax.swing.JPanel;
 +import javax.swing.JTextField;
 +import javax.swing.SwingConstants;
 +import javax.swing.border.EmptyBorder;
 +
 +import common.HouseInterface;
++
 +import configuration.___IntNames;
 +import domain.Districs;
 +import domain.HouseFeatures;
 +import domain.Owner;
 +import domain.RuralHouse;
 +
 +public class ModifyHouseGUI extends JFrame {
 +
 +      /**
 +       * 
 +       */
 +      private static final long serialVersionUID = 1L;
 +      private JPanel contentPane;
 +      private Owner owner;
 +      private JLabel lblDistrict;
 +      private JLabel feedback;
 +      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 String[] distric;
 +      private JTextField baths_f;
 +      private JButton btnConfirm;
 +      private JComboBox<RuralHouse> houseBox;
 +      private  JComboBox<String> comboBox;
 +      private RuralHouse rh;
 +
 +      /**
 +       * Create the frame.
 +       */
 +      public ModifyHouseGUI(final Owner o) {
 +              this.distric=Districs.longNames();
 +               comboBox = new JComboBox<String>(new DefaultComboBoxModel<String>(
 +
 +                              this.distric));
 +              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 Name:");
 +              lblCode.setBounds(15, 88, 64, 14);
 +              lblCode.setHorizontalAlignment(SwingConstants.RIGHT);
 +
 +              lblDistrict = new JLabel("District:");
 +              lblDistrict.setBounds(39, 119, 70, 14);
 +              lblDistrict.setHorizontalAlignment(SwingConstants.RIGHT);
 +
 +              lblDescription = new JLabel("Description:");
 +              lblDescription.setBounds(231, 88, 90, 14);
 +              lblDescription.setHorizontalAlignment(SwingConstants.RIGHT);
 +
 +              description_f = new JTextField();
 +              description_f.setBounds(241, 113, 178, 129);
 +              description_f.setColumns(10);
 +
 +              lblKitchen = new JLabel("Kitchens:");
 +              lblKitchen.setBounds(230, 316, 70, 14);
 +              lblKitchen.setHorizontalAlignment(SwingConstants.RIGHT);
 +
 +              kitchens_f = new JTextField();
 +              kitchens_f.setBounds(318, 313, 86, 20);
 +              kitchens_f.setColumns(10);
 +
 +              lblRooms = new JLabel("Rooms:");
 +              lblRooms.setBounds(39, 316, 70, 14);
 +              lblRooms.setHorizontalAlignment(SwingConstants.RIGHT);
 +
 +              rooms_f = new JTextField();
 +              rooms_f.setBounds(127, 313, 86, 20);
 +              rooms_f.setColumns(10);
 +
 +              lblLivings = new JLabel("Living rooms:");
 +              lblLivings.setBounds(237, 354, 63, 14);
 +              lblLivings.setHorizontalAlignment(SwingConstants.RIGHT);
 +
 +              lRooms_f = new JTextField();
 +              lRooms_f.setBounds(318, 351, 86, 20);
 +              lRooms_f.setColumns(10);
 +
 +              lblParkings = new JLabel("Parkings:");
 +              lblParkings.setBounds(39, 404, 70, 14);
 +              lblParkings.setHorizontalAlignment(SwingConstants.RIGHT);
 +
 +              parkings_f = new JTextField();
 +              parkings_f.setBounds(127, 401, 86, 20);
 +              parkings_f.setColumns(10);
 +
 +              lblBaths = new JLabel("Baths:");
 +              lblBaths.setBounds(39, 354, 70, 14);
 +              lblBaths.setHorizontalAlignment(SwingConstants.RIGHT);
 +
 +              baths_f = new JTextField();
 +              baths_f.setBounds(127, 351, 86, 20);
 +              baths_f.setColumns(10);
 +
 +              btnConfirm = new JButton("Confirm");
 +              btnConfirm.setBounds(145, 462, 69, 23);
 +              btnConfirm.addActionListener(new ActionListener() {
 +                      public void actionPerformed(ActionEvent arg0) {
 +
 +                              RuralHouse newRh = new RuralHouse(rh.getHouseName(), owner,
 +                                              description_f.getText(), (String)comboBox.getSelectedItem(),
 +                                              new HouseFeatures(new Integer(rooms_f.getText()),
 +                                                              new Integer(kitchens_f.getText()), new Integer(
 +                                                                              baths_f.getText()), new Integer(
 +                                                                              lRooms_f.getText()), new Integer(
 +                                                                              parkings_f.getText())));
 +                              HouseInterface hm= null;
 +                              try {
 +                                      hm = (HouseInterface) Naming
 +                                                      .lookup(___IntNames.HouseManager);
 +                              } catch (Exception e1) {
 +                                      System.out.println("Error accessing remote authentication: "
 +                                                      + e1.toString());
 +                              }
 +              
 +                              try {
 +                                      if (hm.registerNewHouse(newRh)) {
 +                                              owner.getRuralHouses().add(newRh);
 +                                              houseBox.removeItem(rh);
 +                                              feedback.setText("House properly modified");
 +                                      } else
 +                                              feedback.setText("Imposible to modify the house");
 +                              } catch (RemoteException e) {
 +                                      // TODO Auto-generated catch block
 +                                      e.printStackTrace();
 +                              }
 +
 +                      }
 +              });
 +              HouseInterface hm= null;
 +              try {
 +                      hm = (HouseInterface) Naming
 +                                      .lookup(___IntNames.HouseManager);
 +              } catch (Exception e1) {
 +                      System.out.println("Error accessing remote authentication: "
 +                                      + e1.toString());
 +              }
 +              Vector<RuralHouse> list = null;
 +              try {
 +                      list = hm.getHouses(o, null, null, 0, 0, 0, 0, 0);
 +              } catch (RemoteException e1) {
 +                      e1.printStackTrace();
 +              }
 +              
 +              houseBox = new JComboBox<RuralHouse>(list);
 +              if (!o.getRuralHouses().isEmpty()) {
 +                      rh = (RuralHouse) houseBox.getSelectedItem();                   
 +                      comboBox.setSelectedItem(rh.getDistrict());             
 +                      description_f.setText(rh.getDescription());
 +                      kitchens_f.setText(Integer
 +                                      .toString(rh.getFeatures().getnKitchens()));
 +                      rooms_f.setText(Integer.toString(rh.getFeatures().getnRooms()));
 +                      lRooms_f.setText(Integer.toString(rh.getFeatures().getnLivings()));
 +                      parkings_f.setText(Integer
 +                                      .toString(rh.getFeatures().getnParkings()));
 +                      baths_f.setText(Integer.toString(rh.getFeatures().getnBaths()));
 +                      houseBox.setBounds(89, 85, 124, 20);
 +              }else{
 +                      feedback.setText("Not available houses");
 +                      btnConfirm.setEnabled(false);
 +              }
 +              houseBox.addItemListener(new ItemListener() {
 +                      @Override
 +                      public void itemStateChanged(ItemEvent e) {
 +                              rh = (RuralHouse) houseBox.getSelectedItem();
 +                              comboBox.setSelectedItem(rh.getDistrict());
 +                              description_f.setText(rh.getDescription());
 +                              kitchens_f.setText(Integer.toString(rh.getFeatures()
 +                                              .getnKitchens()));
 +                              rooms_f.setText(Integer.toString(rh.getFeatures().getnRooms()));
 +                              lRooms_f.setText(Integer.toString(rh.getFeatures()
 +                                              .getnLivings()));
 +                              parkings_f.setText(Integer.toString(rh.getFeatures()
 +                                              .getnParkings()));
 +                              baths_f.setText(Integer.toString(rh.getFeatures().getnBaths()));
 +
 +                      }
 +              });
 +              contentPane.setLayout(null);
 +              contentPane.add(lblParkings);
 +              contentPane.add(parkings_f);
 +              contentPane.add(lblRooms);
 +              contentPane.add(rooms_f);
 +              contentPane.add(lblCode);
 +              contentPane.add(houseBox);
 +              contentPane.add(lblBaths);
 +              contentPane.add(baths_f);
 +              contentPane.add(lblDistrict);
 +              contentPane.add(lblLivings);
 +              contentPane.add(lRooms_f);
 +              contentPane.add(lblKitchen);
 +              contentPane.add(kitchens_f);
 +              contentPane.add(description_f);
 +              contentPane.add(lblDescription);
 +              contentPane.add(btnConfirm);
 +
 +              feedback = new JLabel("");
 +              feedback.setBounds(189, 510, 195, 23);
 +              contentPane.add(feedback);
 +              
 +              comboBox.setBounds(127, 116, 86, 20);
 +              contentPane.add(comboBox);
 +      }
 +}
index d5422bf,0000000..3e7a6c6
mode 100644,000000..100644
--- /dev/null
@@@ -1,333 -1,0 +1,334 @@@
 +package gui;
 +
 +import java.awt.Color;
 +import java.awt.Dimension;
 +import java.awt.Rectangle;
 +import java.awt.event.ActionEvent;
 +import java.awt.event.ActionListener;
 +import java.awt.event.FocusEvent;
 +import java.awt.event.FocusListener;
 +import java.awt.event.ItemEvent;
 +import java.awt.event.ItemListener;
 +import java.beans.PropertyChangeEvent;
 +import java.beans.PropertyChangeListener;
 +import java.rmi.Naming;
 +import java.rmi.RemoteException;
 +import java.sql.Date;
 +import java.text.DateFormat;
 +import java.util.Calendar;
 +import java.util.Locale;
 +import java.util.Vector;
 +
 +import javax.swing.JButton;
 +import javax.swing.JComboBox;
 +import javax.swing.JFrame;
 +import javax.swing.JLabel;
 +import javax.swing.JTextField;
 +
 +import com.toedter.calendar.JCalendar;
-               
 +import common.HouseInterface;
 +import common.OfferInterface;
++
 +import configuration.___IntNames;
 +import domain.Offer;
 +import domain.Owner;
 +import domain.RuralHouse;
 +import exceptions.BadDates;
 +
 +public class ModifyOfferGUI extends JFrame {
 +
 +      private static final long serialVersionUID = 1L;
 +
 +      private JComboBox<RuralHouse> jComboBox1;
 +      private JLabel jLabel1 = new JLabel();
 +      private JLabel jLabel2 = new JLabel();
 +      private JTextField jTextField1 = new JTextField();
 +      private JLabel jLabel3 = new JLabel();
 +      private JTextField jTextField2 = new JTextField();
 +      private JLabel jLabel4 = new JLabel();
 +      private JTextField jTextField3 = new JTextField();
 +      private JButton jButton1 = new JButton();
 +      // Code for JCalendar
 +      private JCalendar jCalendar1 = new JCalendar();
 +      private JCalendar jCalendar2 = new JCalendar();
 +      private Calendar calendarInicio = null;
 +      private Calendar calendarFin = null;
 +      private JButton jButton2 = new JButton();
 +      private JLabel jLabel5 = new JLabel();
 +      private final JLabel jLabel1_o = new JLabel();
 +      private JComboBox<Offer> comboBox_o;
 +      private Vector<RuralHouse> Hlist = null;
 +      private OfferInterface  om = null;
 +      private HouseInterface hm = null;
 +
 +
 +      public ModifyOfferGUI(Owner o) {
 +              try {
 +                      jbInit(o);
 +              } catch (Exception e) {
 +                      e.printStackTrace();
 +              }
 +      }
 +
 +      private void jbInit(Owner o) throws Exception {
 +              this.getContentPane().setLayout(null);
 +              this.setSize(new Dimension(513, 433));
 +              this.setTitle("Set availability");
 +
 +
 +              try {
 +                      om = (OfferInterface) Naming
 +                                      .lookup(___IntNames.OfferManager);
 +                      hm = (HouseInterface) Naming
 +                                      .lookup(___IntNames.HouseManager);
 +              } catch (Exception e1) {
 +                      System.out.println("Error accessing remote authentication: "
 +                                      + e1.toString());
 +              }
 +              try {
 +                      Hlist = hm.getHouses(o, null, null, 0, 0, 0, 0, 0);
 +              } catch (RemoteException e1) {
 +                      e1.printStackTrace();
 +              }
 +
++
 +              jComboBox1 = new JComboBox<RuralHouse>(Hlist);
 +
 +              comboBox_o = new JComboBox<Offer>(
 +                              ((RuralHouse) jComboBox1.getSelectedItem()).getAllOffers());
 +              DateFormat dateformat1 = DateFormat.getDateInstance(1,
 +                              jCalendar1.getLocale());
 +              if (!((RuralHouse) jComboBox1.getSelectedItem()).getAllOffers()
 +                              .isEmpty()) {
 +                      jTextField1.setText(dateformat1.format(((Offer) comboBox_o
 +                                      .getSelectedItem()).getFirstDay()));
 +                      jTextField2.setText(dateformat1.format(((Offer) comboBox_o
 +                                      .getSelectedItem()).getLastDay()));             
 +                      jLabel4.setText(Float.toString(((Offer) comboBox_o
 +                                      .getSelectedItem()).getPrice()));
 +                      jTextField3.setText(Float.toString(((Offer) comboBox_o
 +                                      .getSelectedItem()).getPrice()));
 +              } else {
 +                      jLabel5.setText("There are no offers for the selected rural house");
 +                      jCalendar1.setEnabled(false);
 +                      jCalendar2.setEnabled(false);
 +                      jButton1.setEnabled(false);
 +                      comboBox_o.setEnabled(false);
 +                      jTextField3.setEnabled(false);
 +              }
 +              jComboBox1.setBounds(new Rectangle(115, 12, 115, 20));
 +              jLabel1.setText("List of houses:");
 +              jLabel1.setBounds(new Rectangle(25, 12, 95, 20));
 +              jLabel2.setText("First day :");
 +              jLabel2.setBounds(new Rectangle(25, 75, 85, 25));
 +              jTextField1.setBounds(new Rectangle(25, 265, 220, 25));
 +              jTextField1.setEditable(false);
 +              jLabel3.setText("Last day :");
 +              jLabel3.setBounds(new Rectangle(260, 75, 75, 25));
 +              jTextField2.setBounds(new Rectangle(260, 265, 220, 25));
 +              jTextField2.setEditable(false);
 +              jLabel4.setText("Price:");
 +              jLabel4.setBounds(new Rectangle(260, 30, 75, 20));
 +              jTextField3.setBounds(new Rectangle(350, 30, 115, 20));
 +              jTextField3.setText("0");
 +              jButton1.setText("Accept");
 +              jButton1.setBounds(new Rectangle(100, 360, 130, 30));
 +              jTextField3.addFocusListener(new FocusListener() {
 +                      public void focusGained(FocusEvent e) {
 +                      }
 +
 +                      public void focusLost(FocusEvent e) {
 +                              jTextField3_focusLost();
 +                      }
 +              });
 +
 +              jComboBox1.addItemListener(new ItemListener() {
 +
 +                      @Override
 +                      public void itemStateChanged(ItemEvent arg0) {
++
 +                              Vector<Offer> vo= null;
 +                              try {
 +                                      vo = om.getRuralHouseOffers((RuralHouse) jComboBox1.getSelectedItem());
 +                              } catch (RemoteException e) {
 +                                      // TODO Auto-generated catch block
 +                                      e.printStackTrace();
 +                              }
 +                              comboBox_o.removeAllItems();
 +                              if (!vo.isEmpty()) {
 +                                      jCalendar1.setEnabled(true);
 +                                      jCalendar2.setEnabled(true);
 +                                      jButton1.setEnabled(true);
 +                                      comboBox_o.setEnabled(true);
 +                                      jTextField3.setEnabled(true);
 +                                      jLabel5.setText("");
 +                                      for (Offer of : vo) {
 +                                              comboBox_o.addItem(of);
 +                                      }
 +                              } else {
 +                                      jLabel5.setText("There are no offers for the selected rural house");
 +                                      jCalendar1.setEnabled(false);
 +                                      jCalendar2.setEnabled(false);
 +                                      jButton1.setEnabled(false);
 +                                      comboBox_o.setEnabled(false);
 +                                      jTextField3.setEnabled(false);
 +                                      
 +                              }
 +                      }
 +
 +              });
 +
 +              comboBox_o.addItemListener(new ItemListener() {
 +
 +                      @Override
 +                      public void itemStateChanged(ItemEvent arg0) {
 +                              if (arg0.getStateChange() == ItemEvent.SELECTED) {
 +                                      Offer of = (Offer) comboBox_o.getSelectedItem();
 +                                      DateFormat dateformat1 = DateFormat.getDateInstance(1,
 +                                                      jCalendar1.getLocale());
 +                                      jTextField1.setText(dateformat1.format(of.getFirstDay()));
 +                                      jTextField2.setText(dateformat1.format(of.getLastDay()));
 +                              }
 +                      }
 +
 +              });
 +
 +              jButton1.addActionListener(new ActionListener() {
 +                      public void actionPerformed(ActionEvent e) {
 +                              jButton1_actionPerformed(e);
 +                      }
 +              });
 +              jButton2.setText("Cancel");
 +              jButton2.setBounds(new Rectangle(270, 360, 130, 30));
 +              jButton2.addActionListener(new ActionListener() {
 +                      public void actionPerformed(ActionEvent e) {
 +                              jButton2_actionPerformed(e);
 +                      }
 +              });
 +              jLabel5.setBounds(new Rectangle(100, 320, 300, 20));
 +              jLabel5.setForeground(Color.red);
 +              jLabel5.setSize(new Dimension(305, 20));
 +              jCalendar1.setBounds(new Rectangle(25, 100, 220, 165));
 +              jCalendar2.setBounds(new Rectangle(260, 100, 220, 165));
 +
 +              // Code for JCalendar
 +              this.jCalendar1.addPropertyChangeListener(new PropertyChangeListener() {
 +                      public void propertyChange(PropertyChangeEvent propertychangeevent) {
 +                              if (propertychangeevent.getPropertyName().equals("locale")) {
 +                                      jCalendar1.setLocale((Locale) propertychangeevent
 +                                                      .getNewValue());
 +                                      DateFormat dateformat = DateFormat.getDateInstance(1,
 +                                                      jCalendar1.getLocale());
 +                                      jTextField1.setText(dateformat.format(calendarInicio
 +                                                      .getTime()));
 +                              } else if (propertychangeevent.getPropertyName().equals(
 +                                              "calendar")) {
 +                                      calendarInicio = (Calendar) propertychangeevent
 +                                                      .getNewValue();
 +                                      DateFormat dateformat1 = DateFormat.getDateInstance(1,
 +                                                      jCalendar1.getLocale());
 +                                      jTextField1.setText(dateformat1.format(calendarInicio
 +                                                      .getTime()));
 +                                      jCalendar1.setCalendar(calendarInicio);
 +                              }
 +                      }
 +              });
 +
 +              this.jCalendar2.addPropertyChangeListener(new PropertyChangeListener() {
 +                      public void propertyChange(PropertyChangeEvent propertychangeevent) {
 +                              if (propertychangeevent.getPropertyName().equals("locale")) {
 +                                      jCalendar2.setLocale((Locale) propertychangeevent
 +                                                      .getNewValue());
 +                                      DateFormat dateformat = DateFormat.getDateInstance(1,
 +                                                      jCalendar2.getLocale());
 +                                      jTextField2.setText(dateformat.format(calendarFin.getTime()));
 +                              } else if (propertychangeevent.getPropertyName().equals(
 +                                              "calendar")) {
 +                                      calendarFin = (Calendar) propertychangeevent.getNewValue();
 +                                      DateFormat dateformat1 = DateFormat.getDateInstance(1,
 +                                                      jCalendar2.getLocale());
 +                                      jTextField2.setText(dateformat1.format(calendarFin
 +                                                      .getTime()));
 +                                      jCalendar2.setCalendar(calendarFin);
 +                              }
 +                      }
 +              });
 +
 +              this.getContentPane().add(jCalendar2, null);
 +              this.getContentPane().add(jCalendar1, null);
 +              this.getContentPane().add(jLabel5, null);
 +              this.getContentPane().add(jButton2, null);
 +              this.getContentPane().add(jButton1, null);
 +              this.getContentPane().add(jTextField3, null);
 +              this.getContentPane().add(jLabel4, null);
 +              this.getContentPane().add(jTextField2, null);
 +              this.getContentPane().add(jLabel3, null);
 +              this.getContentPane().add(jTextField1, null);
 +              this.getContentPane().add(jLabel2, null);
 +              this.getContentPane().add(jLabel1, null);
 +              this.getContentPane().add(jComboBox1, null);
 +              jLabel1_o.setText("List of offers:");
 +              jLabel1_o.setBounds(new Rectangle(25, 30, 95, 20));
 +              jLabel1_o.setBounds(25, 44, 95, 20);
 +
 +              getContentPane().add(jLabel1_o);
 +              comboBox_o.setBounds(new Rectangle(115, 30, 115, 20));
 +              comboBox_o.setBounds(115, 44, 115, 20);
 +
 +              getContentPane().add(comboBox_o);
 +      }
 +
 +      private void jButton1_actionPerformed(ActionEvent e) {
 +              RuralHouse ruralHouse = ((RuralHouse) jComboBox1.getSelectedItem());
 +              Date firstDay = new Date(jCalendar1.getCalendar().getTime().getTime());
 +              // Remove the hour:minute:second:ms from the date
 +              firstDay = Date.valueOf(firstDay.toString());
 +              Date lastDay = new Date(jCalendar2.getCalendar().getTime().getTime());
 +              // Remove the hour:minute:second:ms from the date
 +              lastDay = Date.valueOf(lastDay.toString());
 +              
 +
 +              try {
 +
 +                      // It could be to trigger an exception if the introduced string is
 +                      // not a number
 +                      float price = Float.parseFloat(jTextField3.getText());
 +
 +                      // Obtain the business logic from a StartWindow class (local or
 +                      // remote)
 +                      OfferInterface offerM = null;
 +                      try {
 +                              offerM = (OfferInterface) Naming
 +                                              .lookup(___IntNames.OfferManager);
 +                      } catch (Exception e1) {
 +                              System.out.println("Error accessing remote authentication: "
 +                                              + e1.toString());
 +                      }
 +                      
 +                      offerM.deleteOffer(ruralHouse, (Offer) comboBox_o.getSelectedItem());
 +                      offerM.createOffer(ruralHouse, firstDay, lastDay, price);
 +
 +                      jLabel5.setText("Offer modified");
 +
 +              } 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 (Exception e1) {
 +                      e1.printStackTrace();
 +              }
 +      }
 +
 +      private void jButton2_actionPerformed(ActionEvent e) {
 +              this.setVisible(false);
 +      }
 +
 +      private void jTextField3_focusLost() {
 +              try {
 +                      new Integer(jTextField3.getText());
 +                      jLabel5.setText("");
 +              } catch (NumberFormatException ex) {
 +                      jLabel5.setText("Error: Please introduce a number");
 +              }
 +      }
 +}
index 5a4ffe9,0000000..62395d5
mode 100644,000000..100644
--- /dev/null
@@@ -1,162 -1,0 +1,170 @@@
-               
 +package gui;
 +
 +import java.awt.Color;
 +import java.awt.event.ActionEvent;
 +import java.awt.event.ActionListener;
 +import java.rmi.Naming;
 +import java.rmi.RemoteException;
 +
 +import javax.swing.JButton;
 +import javax.swing.JFrame;
 +import javax.swing.JLabel;
 +import javax.swing.JPanel;
 +import javax.swing.JTextField;
 +import javax.swing.border.EmptyBorder;
 +
 +import common.AdminInterface;
 +
 +import configuration.___IntNames;
 +import domain.Owner;
 +
 +public class OwnerRegistrationGUI extends JFrame {
 +
 +      /**
 +       * 
 +       */
 +      private static final long serialVersionUID = 1L;
 +      private JPanel panel;
 +      private JTextField nameField;
 +      private JTextField userNameField;
 +      private AdminInterface am = null;
 +      private JTextField passField;
 +      private JTextField bank1Field;
 +      private JTextField bank2Field;
 +      private JTextField bank3Field;
 +      private JTextField bank4Field;
 +      private JTextField emailField;
 +      private JLabel lblWhenAcceptedYou;
 +      private JLabel feedback;
 +
 +      /**
 +       * Create the frame.
 +       */
 +      public OwnerRegistrationGUI() {
-                       am = (AdminInterface) Naming
-                                       .lookup(___IntNames.AdminManager);
++
 +              try {
-               Owner own = new Owner(this.nameField.getText(),
-                               this.bank1Field.getText() + " " + this.bank2Field.getText()
-                                               + " " + this.bank3Field.getText() + " "
-                                               + this.bank4Field.getText(), this.emailField.getText());
-               try {
-                       if (this.am.addAccountRequest(this.userNameField.getText(),
-                                       this.passField.getText(), own)) {
-                               this.am.saveInstance();
-                               this.feedback.setText("Request sended");
-                       } else {
-                               this.feedback.setText("Can't send the request");
++                      am = (AdminInterface) Naming.lookup(___IntNames.AdminManager);
 +              } catch (Exception e1) {
 +                      System.out.println("Error accessing remote authentication: "
 +                                      + e1.toString());
 +              }
 +              setTitle("Owner registration");
 +              setBounds(100, 100, 500, 400);
 +              panel = new JPanel();
 +              panel.setBorder(new EmptyBorder(5, 5, 5, 5));
 +              setContentPane(panel);
 +              panel.setLayout(null);
 +
 +              JLabel nameLb = new JLabel("Name:");
 +              nameLb.setBounds(37, 45, 46, 14);
 +              panel.add(nameLb);
 +
 +              nameField = new JTextField();
 +              nameField.setBounds(147, 42, 86, 20);
 +              panel.add(nameField);
 +              nameField.setColumns(10);
 +
 +              JLabel lblUsername = new JLabel("Username:");
 +              lblUsername.setBounds(37, 212, 69, 14);
 +              panel.add(lblUsername);
 +
 +              userNameField = new JTextField();
 +              userNameField.setBounds(147, 209, 86, 20);
 +              panel.add(userNameField);
 +              userNameField.setColumns(10);
 +
 +              JLabel lblPassword = new JLabel("Password:");
 +              lblPassword.setBounds(37, 258, 69, 14);
 +              panel.add(lblPassword);
 +
 +              passField = new JTextField();
 +              passField.setBounds(147, 255, 86, 20);
 +              panel.add(passField);
 +              passField.setColumns(10);
 +
 +              JLabel lblBankAccount = new JLabel("Bank account:");
 +              lblBankAccount.setBounds(37, 94, 69, 14);
 +              panel.add(lblBankAccount);
 +
 +              bank1Field = new JTextField();
 +              bank1Field.setBounds(147, 91, 61, 20);
 +              panel.add(bank1Field);
 +
 +              bank2Field = new JTextField();
 +              bank2Field.setBounds(218, 91, 61, 20);
 +              panel.add(bank2Field);
 +
 +              bank3Field = new JTextField();
 +              bank3Field.setBounds(289, 91, 32, 20);
 +              panel.add(bank3Field);
 +
 +              bank4Field = new JTextField();
 +              bank4Field.setBounds(331, 91, 117, 20);
 +              panel.add(bank4Field);
 +
 +              JButton btnSendRegistrationRequest = new JButton(
 +                              "Send registration request");
 +              btnSendRegistrationRequest.setBounds(127, 316, 194, 23);
 +              btnSendRegistrationRequest.addActionListener(new ActionListener() {
 +                      public void actionPerformed(ActionEvent arg0) {
 +
 +                              jButton_ActionPerformed(arg0);
 +                      }
 +              });
 +
 +              panel.add(btnSendRegistrationRequest);
 +
 +              JLabel lblEmail = new JLabel("E-mail:");
 +              lblEmail.setBounds(37, 155, 46, 14);
 +              panel.add(lblEmail);
 +
 +              emailField = new JTextField();
 +              emailField.setBounds(147, 152, 148, 20);
 +              panel.add(emailField);
 +              emailField.setColumns(10);
 +
 +              lblWhenAcceptedYou = new JLabel(
 +                              "When accepted you will receive an e-mail");
 +              lblWhenAcceptedYou.setForeground(Color.GREEN);
 +              lblWhenAcceptedYou.setBounds(127, 291, 214, 14);
 +              panel.add(lblWhenAcceptedYou);
 +
 +              feedback = new JLabel("");
 +              feedback.setForeground(Color.RED);
 +              feedback.setEnabled(false);
 +              feedback.setBounds(127, 344, 214, 20);
 +              panel.add(feedback);
 +      }
 +
 +      private void jButton_ActionPerformed(ActionEvent e) {
 +
-               } catch (RemoteException e1) {
-                       // TODO Auto-generated catch block
-                       e1.printStackTrace();
++              if (!emailField
++                              .getText()
++                              .matches(
++                                              "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$")
++                              || !this.nameField.getText().isEmpty()||this.bank1Field.getText().length()!=4 || this.bank2Field.getText().length()!=4
++                              ||this.bank3Field.getText().length()!=2 || this.bank4Field.getText().length()!=10) {
++                      Owner own = new Owner(this.nameField.getText(),
++                                      this.bank1Field.getText() + " " + this.bank2Field.getText()
++                                                      + " " + this.bank3Field.getText() + " "
++                                                      + this.bank4Field.getText(),
++                                      this.emailField.getText());
++
++                      try {
++                              if (this.am.addAccountRequest(this.userNameField.getText(),
++                                              this.passField.getText(), own)) {
++                                      this.am.saveInstance();
++                                      this.feedback.setText("Request sended");
++                              } else {
++                                      this.feedback.setText("Can't send the request");
++                              }
++                      } catch (RemoteException e1) {
++                              // TODO Auto-generated catch block
++                              e1.printStackTrace();
 +                      }
++              } else {
++                      this.feedback.setText("Bad formatted data");
 +              }
 +
 +      }
 +}
index d112532,0000000..30e5e66
mode 100644,000000..100644
--- /dev/null
@@@ -1,163 -1,0 +1,162 @@@
-                                       houses.remove(rh);
 +package gui;
 +
 +import java.awt.Font;
 +import java.awt.Rectangle;
 +import java.awt.event.ActionEvent;
 +import java.awt.event.ActionListener;
 +import java.rmi.Naming;
 +import java.rmi.RemoteException;
 +import java.util.Enumeration;
 +import java.util.Vector;
 +
 +import javax.swing.JButton;
 +import javax.swing.JFrame;
 +import javax.swing.JLabel;
 +import javax.swing.JPanel;
 +import javax.swing.JScrollPane;
 +import javax.swing.JTable;
 +import javax.swing.border.EmptyBorder;
 +import javax.swing.table.DefaultTableModel;
 +
 +import common.AdminInterface;
 +import common.HouseInterface;
 +
 +import configuration.___IntNames;
 +import domain.RuralHouse;
 +
 +public class listOfAdditionRequestsGUI extends JFrame {
 +
 +      /**
 +       * 
 +       */
 +      private static final long serialVersionUID = 1L;
 +      private JPanel contentPane;
 +      private JTable table;
 +      private DefaultTableModel tableModel;
 +      private AdminInterface am = null;
 +      private Vector<RuralHouse> houses;
 +      /**
 +       * Create the frame.
 +       */
 +      public listOfAdditionRequestsGUI() {
 +              
 +              try {
 +                      am = (AdminInterface) Naming
 +                                      .lookup(___IntNames.AdminManager);
 +              } catch (Exception e1) {
 +                      System.out.println("Error accessing remote authentication: "
 +                                      + e1.toString());
 +              }
 +              
 +              setTitle("Adding requests");
 +              try {
 +                      this.houses= am.getAdditionRequests();
 +                      init();
 +              } catch (Exception e) {
 +                      e.printStackTrace();
 +              }
 +      }
 +
 +      private void init() throws Exception {
 +              setBounds(100, 100, 600, 450);
 +              contentPane = new JPanel();
 +              contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
 +              setContentPane(contentPane);
 +              contentPane.setLayout(null);
 +
 +              JLabel lblNewLabel = new JLabel();
 +              lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 27));
 +              lblNewLabel.setBounds(23, 41, 536, 33);
 +              contentPane.add(lblNewLabel);
 +              if (houses.isEmpty())
 +                      lblNewLabel.setText("There are not houses to be added");
 +              else
 +                      lblNewLabel.setText("List of houses to be added:");
 +              JScrollPane scrollPane = new JScrollPane();
 +              scrollPane.setBounds(new Rectangle(45, 305, 320, 116));
 +              scrollPane.setBounds(23, 113, 536, 271);
 +              contentPane.add(scrollPane);
 +
 +              table = new JTable() {
 +              private static final long serialVersionUID = 1L;
 +
 +              public boolean isCellEditable(int row, int column) {                
 +                      return false;               
 +              };
 +          };
 +              scrollPane.setViewportView(table);
 +              tableModel = new DefaultTableModel(null, new String[] {
 +                              "House Name", "Bedrooms", "Kitchens", "Baths", "Parkings",
 +                              "Livings" });
 +              
 +              //Maybe there is a better way to avoid interaction.
 +              //table.setEnabled(false);
 +              table.setModel(tableModel);
 +              
 +              JButton btnNewButton = new JButton("Confirm Addition");
 +              btnNewButton.addActionListener(new ActionListener() {
 +                      public void actionPerformed(ActionEvent e) {
 +                              if (table.getRowCount()!=0 && table.getSelectedRow() != -1) {
 +                                      HouseInterface hm= null;
 +                                      try {
 +                                              hm = (HouseInterface) Naming
 +                                                              .lookup(___IntNames.HouseManager);
 +                                      } catch (Exception e1) {
 +                                              System.out.println("Error accessing remote authentication: "
 +                                                              + e1.toString());
 +                                      }
 +                                      
 +                                      RuralHouse rh = houses.get(table.getSelectedRow());
 +                                      //TODO when the house is not added show a warning to the user. Method below returns a boolean stating that.
 +                                      try {
 +                                              hm.registerNewHouse(rh);
 +                                              am.removeHouseAdditionRequests(rh);
 +                                              am.saveInstance();
 +                                      } catch (RemoteException e1) {
 +                                              // TODO Auto-generated catch block
 +                                              e1.printStackTrace();
 +                                      }
 +                                      
 +                                      ((DefaultTableModel)table.getModel()).removeRow(houses.indexOf(rh));
 +                              }
 +                      }
 +              });
 +              btnNewButton.setBounds(88, 396, 169, 25);
 +              contentPane.add(btnNewButton);
 +              
 +              JButton btnDenyAddition = new JButton("Deny Addition");
 +              btnDenyAddition.addActionListener(new ActionListener() {
 +                      public void actionPerformed(ActionEvent arg0) {
 +                              if (table.getRowCount()!=0 && table.getSelectedRow() != -1) {
 +                                      RuralHouse rh = houses.get(table.getSelectedRow());
 +                                      try {
 +                                              am.removeHouseAdditionRequests(rh);
 +                                              am.saveInstance();
 +                                      } catch (RemoteException e) {
 +                                              // TODO Auto-generated catch block
 +                                              e.printStackTrace();
 +                                      }
 +                                      ((DefaultTableModel)table.getModel()).removeRow(houses.indexOf(rh));
 +                                      houses.remove(rh);
 +                              }
 +                      }
 +              });
 +              btnDenyAddition.setBounds(300, 396, 169, 25);
 +              contentPane.add(btnDenyAddition);
 +              Enumeration<RuralHouse> en = houses.elements();
 +              RuralHouse rh;
 +              
 +              while (en.hasMoreElements()) {
 +                      rh = en.nextElement();
 +                      Vector<Object> row = new Vector<Object>();
 +                      row.add(rh.getHouseName());
 +                      row.add(rh.getFeatures().getnRooms());
 +                      row.add(rh.getFeatures().getnKitchens());
 +                      row.add(rh.getFeatures().getnBaths());
 +                      row.add(rh.getFeatures().getnParkings());
 +                      row.add(rh.getFeatures().getnLivings());
 +                      tableModel.addRow(row);
 +              }
 +
 +      }
 +}
index 982d7f2,0000000..423ea4d
mode 100644,000000..100644
--- /dev/null
@@@ -1,140 -1,0 +1,197 @@@
-       private BookingInterface bookM =null;
 +package gui;
 +
++import java.awt.Color;
++import java.awt.Component;
 +import java.awt.Font;
 +import java.awt.Rectangle;
 +import java.awt.event.ActionEvent;
 +import java.awt.event.ActionListener;
++import java.rmi.Naming;
 +import java.rmi.RemoteException;
 +import java.util.Enumeration;
 +import java.util.Vector;
 +
 +import javax.swing.JButton;
 +import javax.swing.JFrame;
 +import javax.swing.JLabel;
 +import javax.swing.JPanel;
 +import javax.swing.JScrollPane;
 +import javax.swing.JTable;
 +import javax.swing.border.EmptyBorder;
++import javax.swing.table.DefaultTableCellRenderer;
 +import javax.swing.table.DefaultTableModel;
 +
 +import common.BookingInterface;
 +
++import configuration.___IntNames;
 +import domain.Booking;
 +import domain.Offer;
 +
 +public class listOfBookingRequestsGUI extends JFrame {
 +
 +      /**
 +       * 
 +       */
 +      private static final long serialVersionUID = 1L;
 +      private JPanel contentPane;
 +      private JTable table;
 +      private Offer off;
-               
-               this.bookings= this.off.getBookings();
++      private BookingInterface bookM = null;
 +      private DefaultTableModel tableModel;
 +      private Vector<Booking> bookings = new Vector<Booking>();
 +
 +      /**
 +       * Create the frame.
 +       */
 +      public listOfBookingRequestsGUI(Offer of) {
 +              setTitle("Adding requests");
 +              this.off = of;
 +
 +              try {
 +
 +                      init();
 +              } catch (Exception e) {
 +                      e.printStackTrace();
 +              }
 +      }
 +
 +      private void init() throws Exception {
 +              setBounds(100, 100, 600, 500);
 +              contentPane = new JPanel();
 +              contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
 +              setContentPane(contentPane);
 +              contentPane.setLayout(null);
-               if (bookings.isEmpty())
-                       lblNewLabel
-                                       .setText("There are not bookings to be confirmed or denied");
-               else
-                       lblNewLabel.setText("List of bookings:");
++
++              this.bookings = this.off.getBookings();
 +              JLabel lblNewLabel = new JLabel();
 +              lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 27));
 +              lblNewLabel.setBounds(23, 41, 536, 33);
 +              contentPane.add(lblNewLabel);
-               tableModel = new DefaultTableModel(null, new String[] {
-                               "Booking Number", "Booking Date","Name","E-mail", "Telephone" });
 +              JScrollPane scrollPane = new JScrollPane();
 +              scrollPane.setBounds(new Rectangle(45, 305, 320, 116));
 +              scrollPane.setBounds(23, 113, 536, 271);
 +              contentPane.add(scrollPane);
 +
 +              table = new JTable() {
 +                      private static final long serialVersionUID = 1L;
 +
 +                      public boolean isCellEditable(int row, int column) {
 +                              return false;
 +                      };
 +              };
 +              scrollPane.setViewportView(table);
-               // Maybe there is a better way to avoid interaction.
-               // table.setEnabled(false);
++              tableModel = new DefaultTableModel(null,
++                              new String[] { "Booking Number", "Booking Date", "Name",
++                                              "E-mail", "Telephone" });
 +
-                                       if (table.getRowCount() != 0 && table.getSelectedRow() != -1) {
 +              table.setModel(tableModel);
 +
 +              JButton btnNewButton = new JButton("Confirm Booking");
 +              btnNewButton.addActionListener(new ActionListener() {
 +                      public void actionPerformed(ActionEvent e) {
++                              try {
++                                      bookM = (BookingInterface) Naming
++                                                      .lookup(___IntNames.BookingManager);
++                              } catch (Exception e1) {
++                                      System.out
++                                                      .println("Error accessing remote authentication: "
++                                                                      + e1.toString());
++                              }
 +                              if (table.getRowCount() != 0 && table.getSelectedRow() != -1) {
-                                               bookM.removeDenyBooking(book);
++                                      if (table.getRowCount() != 0
++                                                      && table.getSelectedRow() != -1) {
 +                                              Booking book = bookings.get(table.getSelectedRow());
 +                                              try {
 +                                                      bookM.acceptBooking(book);
 +                                              } catch (RemoteException e1) {
 +                                                      e1.printStackTrace();
 +                                              }
++                                              contentPane.setVisible(false);
++
 +                                      }
 +
 +                              }
 +                      }
 +              });
 +              btnNewButton.setBounds(33, 396, 169, 25);
 +              contentPane.add(btnNewButton);
 +
 +              JButton btnDenyAddition = new JButton("Deny Booking");
 +              btnDenyAddition.addActionListener(new ActionListener() {
 +                      public void actionPerformed(ActionEvent arg0) {
++                              try {
++                                      bookM = (BookingInterface) Naming
++                                                      .lookup(___IntNames.BookingManager);
++                              } catch (Exception e1) {
++                                      System.out
++                                                      .println("Error accessing remote authentication: "
++                                                                      + e1.toString());
++                              }
 +                              if (table.getRowCount() != 0 && table.getSelectedRow() != -1) {
 +                                      Booking book = bookings.get(table.getSelectedRow());
 +                                      try {
-               
++                                              bookM.denyBooking(book);
 +                                      } catch (RemoteException e) {
 +                                              e.printStackTrace();
 +                                      }
++                                      ((DefaultTableModel) table.getModel()).removeRow(table
++                                                      .getSelectedRow());
++                                      bookings.remove(book);
 +
 +                              }
 +                      }
 +              });
++              if (bookings.isEmpty())
++                      lblNewLabel
++                                      .setText("There are not bookings to be confirmed or denied");
++              else {
++                      lblNewLabel.setText("List of bookings:");
++                      if (this.bookings.get(0).getOffer().isBooked()) {
++                              btnDenyAddition.setEnabled(false);
++                              btnNewButton.setEnabled(false);
++                      }
++              }
++              
 +              btnDenyAddition.setBounds(390, 395, 169, 25);
 +              contentPane.add(btnDenyAddition);
++
 +              Enumeration<Booking> en = this.bookings.elements();
 +              Booking book;
 +              while (en.hasMoreElements()) {
 +                      book = en.nextElement();
 +                      Vector<Object> row = new Vector<Object>();
 +                      row.add(book.getBookNumber());
 +                      row.add(book.getBookDate());
 +                      row.add(book.getClient().getName());
 +                      row.add(book.getClient().getMailAccount());
 +                      row.add(book.getClient().getTelephone());
 +                      tableModel.addRow(row);
 +              }
++              table.setDefaultRenderer(Object.class, new DefaultTableCellRenderer() {
++                      /**
++                       * 
++                       */
++                      private static final long serialVersionUID = 1L;
++
++                      @Override
++                      public Component getTableCellRendererComponent(JTable table,
++                                      Object value, boolean isSelected, boolean hasFocus,
++                                      int row, int col) {
 +
++                              super.getTableCellRendererComponent(table, value, isSelected,
++                                              hasFocus, row, col);
++
++                              if (!bookings.get(row).getOffer().isBooked()) {
++                                      setBackground(Color.RED);
++                                      setForeground(Color.BLACK);
++                              } else {
++                                      setBackground(Color.GREEN);
++                                      setForeground(Color.BLACK);
++                              }
++
++                              return this;
++                      }
++              });
 +      }
++
 +}
index 1a49f1c,0000000..7d61def
mode 100644,000000..100644
--- /dev/null
@@@ -1,110 -1,0 +1,138 @@@
 +package gui;
 +
++import java.awt.Color;
++import java.awt.Component;
 +import java.awt.Font;
 +import java.awt.Rectangle;
 +import java.awt.event.MouseAdapter;
 +import java.awt.event.MouseEvent;
 +import java.util.Enumeration;
 +import java.util.Vector;
 +
 +import javax.swing.JFrame;
 +import javax.swing.JLabel;
 +import javax.swing.JPanel;
 +import javax.swing.JScrollPane;
 +import javax.swing.JTable;
 +import javax.swing.border.EmptyBorder;
++import javax.swing.table.DefaultTableCellRenderer;
 +import javax.swing.table.DefaultTableModel;
 +
 +import domain.Offer;
 +import domain.Owner;
 +import domain.RuralHouse;
 +
 +public class listOfOffers extends JFrame {
 +
 +      /**
 +       * 
 +       */
 +      private static final long serialVersionUID = 1L;
 +      private JPanel contentPane;
 +      private JTable table;
 +      private Owner owner;
 +
 +      private DefaultTableModel tableModel;
 +      private Vector<Offer> offers = new Vector<Offer>();
 +
 +      /**
 +       * Create the frame.
 +       */
 +      public listOfOffers(Owner own) {
 +              setTitle("Adding requests");
 +              this.owner = own;
 +              try {
 +
 +                      init();
 +              } catch (Exception e) {
 +                      e.printStackTrace();
 +              }
 +      }
 +
 +      private void init() throws Exception {
 +              setBounds(100, 100, 600, 450);
 +              contentPane = new JPanel();
 +              contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
 +              setContentPane(contentPane);
 +              contentPane.setLayout(null);
 +              this.offers = new Vector<Offer>();
 +              for (RuralHouse rh: this.owner.getRuralHouses()){
 +                      this.offers.addAll(rh.getAllOffers());
 +              }
 +              JLabel lblNewLabel = new JLabel();
 +              lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 27));
 +              lblNewLabel.setBounds(23, 41, 536, 33);
 +              contentPane.add(lblNewLabel);
 +              if (this.offers.isEmpty())
 +                      lblNewLabel
 +                                      .setText("There are not bookings to be confirmed or denied");
 +              else
 +                      lblNewLabel.setText("List of offers:");
 +              JScrollPane scrollPane = new JScrollPane();
 +              scrollPane.setBounds(new Rectangle(45, 305, 320, 116));
 +              scrollPane.setBounds(23, 113, 536, 271);
 +              contentPane.add(scrollPane);
 +              
 +              table = new JTable() {
 +                      private static final long serialVersionUID = 1L;
 +
 +                      public boolean isCellEditable(int row, int column) {
 +                              return false;
 +                      };
 +              };
 +              
 +              scrollPane.setViewportView(table);
 +              tableModel = new DefaultTableModel(null, new String[] { "Offer #",
 +                              "FirstDay", "LastDay", "Price" ,"RuralHouse"});
 +
 +              // Maybe there is a better way to avoid interaction.
 +              // table.setEnabled(false);
 +              table.setModel(tableModel);
 +              table.addMouseListener( new MouseAdapter(){                     
 +                      @Override
 +                      public void mouseClicked(MouseEvent arg0) {
 +                              int row = table.getSelectedRow();
 +                              listOfBookingRequestsGUI feat = new listOfBookingRequestsGUI(offers.get(row));
 +                              feat.setVisible(true);
 +                      }
 +              });
 +              Enumeration<Offer> rhs = this.offers.elements();
 +              while (rhs.hasMoreElements()) {
 +                      Offer of = rhs.nextElement();
 +                      Vector<Object> row = new Vector<Object>();
 +                      row.add(of.getOfferNumber());
 +                      row.add(of.getFirstDay());
 +                      row.add(of.getLastDay());
 +                      row.add(of.getPrice());
 +                      row.add(of.getRuralHouse().getHouseName());
 +                      tableModel.addRow(row);
 +              }
++              
++              table.setDefaultRenderer(Object.class, new DefaultTableCellRenderer() {
++                      /**
++                       * 
++                       */
++                      private static final long serialVersionUID = 1L;
++
++                      @Override
++                      public Component getTableCellRendererComponent(JTable table,
++                                      Object value, boolean isSelected, boolean hasFocus,
++                                      int row, int col) {
++
++                              super.getTableCellRendererComponent(table, value, isSelected,
++                                              hasFocus, row, col);
++
++                              if (!offers.get(row).isBooked()) {
++                                      setBackground(Color.ORANGE);
++                                      setForeground(Color.BLACK);
++                              } else {
++                                      setBackground(Color.GREEN);
++                                      setForeground(Color.BLACK);
++                              }
++
++                              return this;
++                      }
++              });
 +
 +      }
 +}
index 01aaf8f,0000000..b3297b4
mode 100644,000000..100644
--- /dev/null
@@@ -1,158 -1,0 +1,159 @@@
-                       
 +package gui;
 +
 +import java.awt.Font;
 +import java.awt.Rectangle;
 +import java.awt.event.ActionEvent;
 +import java.awt.event.ActionListener;
 +import java.rmi.Naming;
 +import java.rmi.RemoteException;
 +import java.util.Enumeration;
 +import java.util.Vector;
 +
 +import javax.swing.JButton;
 +import javax.swing.JFrame;
 +import javax.swing.JLabel;
 +import javax.swing.JPanel;
 +import javax.swing.JScrollPane;
 +import javax.swing.JTable;
 +import javax.swing.border.EmptyBorder;
 +import javax.swing.table.DefaultTableModel;
 +
 +import common.AccountInterface;
 +import common.AdminInterface;
 +
 +import configuration.___IntNames;
 +import domain.Account;
 +
 +public class listOfOwnerAddittionRequests extends JFrame {
 +
 +      /**
 +       * 
 +       */
 +      private static final long serialVersionUID = 1L;
 +      private JPanel contentPane;
 +      private JTable table;
 +      private DefaultTableModel tableModel;
 +      private AdminInterface am = null;
 +      private Vector<Account> accounts;
 +      /**
 +       * Create the frame.
 +       */
 +      public  listOfOwnerAddittionRequests()  {
 +              try {
 +                      am = (AdminInterface) Naming
 +                                      .lookup(___IntNames.AdminManager);
 +              } catch (Exception e1) {
 +                      System.out.println("Error accessing remote authentication: "
 +                                      + e1.toString());
 +              }               
 +              setTitle("Adding requests");
 +              try {
 +                      this.accounts= am.getOwnerAdditionRequests();
 +                      init();
 +              } catch (Exception e) {
 +                      e.printStackTrace();
 +              }
 +      }
 +
 +      private void init() throws Exception {
 +              
 +              try {
 +                      am = (AdminInterface) Naming
 +                                      .lookup(___IntNames.AdminManager);
 +              } catch (Exception e1) {
 +                      System.out.println("Error accessing remote authentication: "
 +                                      + e1.toString());
 +              }
 +              setBounds(100, 100, 600, 450);
 +              contentPane = new JPanel();
 +              contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
 +              setContentPane(contentPane);
 +              contentPane.setLayout(null);
 +
 +              JLabel lblNewLabel = new JLabel();
 +              lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 27));
 +              lblNewLabel.setBounds(23, 41, 536, 33);
 +              contentPane.add(lblNewLabel);
 +              if (accounts.isEmpty())
 +                      lblNewLabel.setText("There are not owners to be added");
 +              else
 +                      lblNewLabel.setText("List of owners to be added:");
 +              JScrollPane scrollPane = new JScrollPane();
 +              scrollPane.setBounds(new Rectangle(45, 305, 320, 116));
 +              scrollPane.setBounds(23, 113, 536, 271);
 +              contentPane.add(scrollPane);
 +
 +              table = new JTable() {
 +              private static final long serialVersionUID = 1L;
 +
 +              public boolean isCellEditable(int row, int column) {                
 +                      return false;               
 +              };
 +          };
 +              scrollPane.setViewportView(table);
 +              tableModel = new DefaultTableModel(null, new String[] {
 +                              "Name", "E-mail", "Bank Account" });
 +              
 +              table.setModel(tableModel);
 +              
 +              JButton btnNewButton = new JButton("Confirm Addition");
 +              btnNewButton.addActionListener(new ActionListener() {
 +                      public void actionPerformed(ActionEvent e) {
 +                              if (table.getRowCount()!=0 && table.getSelectedRow() != -1) {
 +                                      AccountInterface acm = null;
 +                                      
 +                                      try {
 +                                              acm = (AccountInterface) Naming
 +                                                              .lookup(___IntNames.AccountManager);
 +                                      } catch (Exception e1) {
 +                                              System.out.println("Error accessing remote authentication: "
 +                                                              + e1.toString());
 +                                      }
 +
 +                                      try {
 +                                              acm.addAccount(table.getSelectedRow());
 +                                              am.removeOwnerAdditionRequests(table.getSelectedRow());
 +                                              am.saveInstance();
 +                                      } catch (RemoteException e1) {
 +                                              e1.printStackTrace();
 +                                      }
++                                      
 +                                      ((DefaultTableModel)table.getModel()).removeRow(table.getSelectedRow());
++                                      
 +                              }
 +                      }
 +              });
 +              btnNewButton.setBounds(88, 396, 169, 25);
 +              contentPane.add(btnNewButton);
 +              
 +              JButton btnDenyAddition = new JButton("Deny Addition");
 +              btnDenyAddition.addActionListener(new ActionListener() {
 +                      public void actionPerformed(ActionEvent arg0) {
 +                              if (table.getRowCount()!=0 && table.getSelectedRow() != -1) {
 +                                      try {
 +                                              am.removeOwnerAdditionRequests(table.getSelectedRow());
 +                                              am.saveInstance();
 +                                      } catch (RemoteException e) {
 +                                              e.printStackTrace();
 +                                      }
 +                                      
 +                                      ((DefaultTableModel)table.getModel()).removeRow(table.getSelectedRow());
 +                              }
 +                      }
 +              });
 +              btnDenyAddition.setBounds(300, 396, 169, 25);
 +              contentPane.add(btnDenyAddition);
 +              Enumeration<Account> en = accounts.elements();
 +              Account acc;
 +              
 +              while (en.hasMoreElements()) {
 +                      acc = en.nextElement();
 +                      Vector<Object> row = new Vector<Object>();
 +                      row.add(acc.getOwner().getName());
 +                      row.add(acc.getOwner().getMailAccount());
 +                      row.add(acc.getOwner().getBankAccount());                       
 +                      tableModel.addRow(row);
 +              }
 +
 +      }
 +}
index 62daded,0000000..a85c246
mode 100644,000000..100644
--- /dev/null
@@@ -1,160 -1,0 +1,158 @@@
-                       am = (AdminInterface) Naming
-                                       .lookup(___IntNames.AdminManager);
 +package gui;
 +
 +import java.awt.Font;
 +import java.awt.Rectangle;
 +import java.awt.event.ActionEvent;
 +import java.awt.event.ActionListener;
 +import java.rmi.Naming;
 +import java.rmi.RemoteException;
 +import java.util.Enumeration;
 +import java.util.Vector;
 +
 +import javax.swing.JButton;
 +import javax.swing.JFrame;
 +import javax.swing.JLabel;
 +import javax.swing.JPanel;
 +import javax.swing.JScrollPane;
 +import javax.swing.JTable;
 +import javax.swing.border.EmptyBorder;
 +import javax.swing.table.DefaultTableModel;
 +
 +import common.AdminInterface;
 +import common.HouseInterface;
 +
 +import configuration.___IntNames;
 +import domain.RuralHouse;
 +
 +public class listOfRemovalRequestsGUI extends JFrame {
 +
 +      /**
 +       * 
 +       */
 +      private static final long serialVersionUID = 1L;
 +      private JPanel contentPane;
 +      private JTable table;
 +      private DefaultTableModel tableModel;
 +      private AdminInterface am = null;
 +      private Vector<RuralHouse> houses;
 +
 +      /**
 +       * Create the frame.
 +       */
 +      public listOfRemovalRequestsGUI() {
 +              try {
-                                       HouseInterface hm= null;
++                      am = (AdminInterface) Naming.lookup(___IntNames.AdminManager);
 +              } catch (Exception e1) {
 +                      System.out.println("Error accessing remote authentication: "
 +                                      + e1.toString());
 +              }
 +              setTitle("Deleting requests");
 +              try {
 +                      this.houses = am.getDeletionRequests();
 +                      init();
 +              } catch (Exception e) {
 +                      e.printStackTrace();
 +              }
 +      }
 +
 +      private void init() throws Exception {
 +              setBounds(100, 100, 600, 450);
 +              contentPane = new JPanel();
 +              contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
 +              setContentPane(contentPane);
 +              contentPane.setLayout(null);
 +
 +              JLabel lblNewLabel = new JLabel();
 +              lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 27));
 +              lblNewLabel.setBounds(23, 41, 536, 33);
 +              contentPane.add(lblNewLabel);
 +              if (houses.isEmpty())
 +                      lblNewLabel.setText("There are not houses to be deleted");
 +              else
 +                      lblNewLabel.setText("List of houses to be deleted:");
 +              JScrollPane scrollPane = new JScrollPane();
 +              scrollPane.setBounds(new Rectangle(45, 305, 320, 116));
 +              scrollPane.setBounds(23, 113, 536, 271);
 +              contentPane.add(scrollPane);
 +
 +              table = new JTable() {
 +                      private static final long serialVersionUID = 1L;
 +
 +                      public boolean isCellEditable(int row, int column) {
 +                              return false;
 +                      };
 +              };
 +              scrollPane.setViewportView(table);
 +              tableModel = new DefaultTableModel(null, new String[] { "House Name",
 +                              "Bedrooms", "Kitchens", "Baths", "Parkings", "Livings" });
 +
 +              table.setModel(tableModel);
 +              Enumeration<RuralHouse> en = houses.elements();
 +              RuralHouse rh;
 +              JButton btnNewButton = new JButton("Confirm Deletion");
 +              btnNewButton.addActionListener(new ActionListener() {
 +                      public void actionPerformed(ActionEvent e) {
 +                              if (table.getRowCount() != 0 && table.getSelectedRow() != -1) {
-                                               System.out.println("Error accessing remote authentication: "
-                                                               + e1.toString());
++                                      HouseInterface hm = null;
 +                                      try {
 +                                              hm = (HouseInterface) Naming
 +                                                              .lookup(___IntNames.HouseManager);
 +                                      } catch (Exception e1) {
-                                       ((DefaultTableModel)table.getModel()).removeRow(houses.indexOf(rh));
-                                               try {
-                                                       hm.removeHouse(rh, rh.getOwner());
-                                                       am.removeHouseDeletionRequests(rh);
-                                                       am.saveInstance();
-                                               } catch (RemoteException e1) {
-                                                       // TODO Auto-generated catch block
-                                                       e1.printStackTrace();
-                                               }
-                                               houses.remove(rh);
-                                               
-                                       
++                                              System.out
++                                                              .println("Error accessing remote authentication: "
++                                                                              + e1.toString());
 +                                      }
 +                                      RuralHouse rh = houses.get(table.getSelectedRow());
-               
++
++                                      try {
++                                              hm.removeHouse(rh, rh.getOwner());
++                                              am.removeHouseDeletionRequests(rh);
++                                              am.saveInstance();
++                                      } catch (RemoteException e1) {
++                                              e1.printStackTrace();
++                                      }
++                                      ((DefaultTableModel) table.getModel()).removeRow(houses
++                                                      .indexOf(rh));
++                                      houses.remove(rh);
++
 +                              }
 +                      }
 +              });
 +              btnNewButton.setBounds(90, 396, 169, 25);
 +              contentPane.add(btnNewButton);
-                                       ((DefaultTableModel)table.getModel()).removeRow(houses.indexOf(rh));
-                                               houses.remove(rh);
-                                               try {
-                                                       am.removeHouseDeletionRequests(rh);
-                                                       am.saveInstance();
-                                               } catch (RemoteException e1) {
-                                                       // TODO Auto-generated catch block
-                                                       e1.printStackTrace();
-                                               }
-                                               
-                                       
++
 +              JButton btnNewButton_1 = new JButton("Deny Deletion");
 +              btnNewButton_1.addActionListener(new ActionListener() {
 +                      public void actionPerformed(ActionEvent e) {
 +                              if (table.getRowCount() != 0 && table.getSelectedRow() != -1) {
 +                                      RuralHouse rh = houses.get(table.getSelectedRow());
++                                      ((DefaultTableModel) table.getModel()).removeRow(houses
++                                                      .indexOf(rh));
++                                      houses.remove(rh);
++                                      try {
++                                              am.removeHouseDeletionRequests(rh);
++                                              am.saveInstance();
++                                      } catch (RemoteException e1) {
++                                              // TODO Auto-generated catch block
++                                              e1.printStackTrace();
++                                      }
++
 +                              }
 +                      }
 +              });
 +              btnNewButton_1.setBounds(291, 396, 169, 25);
 +              contentPane.add(btnNewButton_1);
 +              while (en.hasMoreElements()) {
 +                      rh = en.nextElement();
 +                      Vector<Object> row = new Vector<Object>();
 +                      row.add(rh.getHouseName());
 +                      row.add(rh.getFeatures().getnRooms());
 +                      row.add(rh.getFeatures().getnKitchens());
 +                      row.add(rh.getFeatures().getnBaths());
 +                      row.add(rh.getFeatures().getnParkings());
 +                      row.add(rh.getFeatures().getnLivings());
 +                      tableModel.addRow(row);
 +              }
 +
 +      }
 +}