Merge branch 'master' of https://xp-dev.com/git/RRRRHHHH_Code
authorcamjan <jcampos004@ikasle.ehu.es>
Tue, 19 May 2015 23:23:13 +0000 (01:23 +0200)
committercamjan <jcampos004@ikasle.ehu.es>
Tue, 19 May 2015 23:23:13 +0000 (01:23 +0200)
Conflicts:
ruralHouses client/src/gui/HouseFeaturesGUI.java
ruralHouses client/src/gui/ModifyOfferGUI.java
ruralHouses/src/domain/RuralHouse.java

14 files changed:
1  2 
ruralHouses client/src/common/AccountInterface.java
ruralHouses client/src/gui/AdminMenuGUI.java
ruralHouses client/src/gui/DeleteOwnerGUI.java
ruralHouses client/src/gui/HouseFeaturesGUI.java
ruralHouses client/src/gui/ModifyHouseGUI.java
ruralHouses client/src/gui/ModifyOfferGUI.java
ruralHouses client/src/gui/listOfBookingRequestsGUI.java
ruralHouses/src/businessLogic/AccountManager.java
ruralHouses/src/businessLogic/BookingManager.java
ruralHouses/src/businessLogic/OfferManager.java
ruralHouses/src/common/AccountInterface.java
ruralHouses/src/dataAccess/DB4oManager.java
ruralHouses/src/domain/Account.java
ruralHouses/src/domain/RuralHouse.java

@@@ -3,8 -3,8 +3,6 @@@ package common
  import java.rmi.Remote;
  import java.rmi.RemoteException;
  
--import domain.Account;
--
  public interface AccountInterface extends Remote{
        
  
@@@ -4,8 -4,8 +4,6 @@@ import java.awt.Frame
  import java.awt.event.ActionEvent;
  import java.awt.event.ActionListener;
  
--import javax.swing.GroupLayout;
--import javax.swing.GroupLayout.Alignment;
  import javax.swing.JButton;
  import javax.swing.JFrame;
  import javax.swing.JPanel;
index 75305dc,0000000..fb2fcdb
mode 100644,000000..100644
--- /dev/null
@@@ -1,144 -1,0 +1,139 @@@
- import java.awt.Color;
- import java.awt.Component;
 +package gui;
 +
- import java.awt.event.MouseAdapter;
- import java.awt.event.MouseEvent;
 +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.OwnerInterface;
++
 +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 OwnerInterface Own = 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 {
 +                      Own = (OwnerInterface) Naming
 +                                      .lookup(___IntNames.OwnerManager);
 +              } catch (Exception e1) {
 +                      System.out
 +                                      .println("Error accessing remote authentication: "
 +                                                      + e1.toString());
 +              }
 +              this.owners = Own.getOwners();
 +              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);
 +              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);
 +              }
 +              
 +              
 +      }
 +}
@@@ -25,10 -26,12 +26,12 @@@ 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;
  
@@@ -68,8 -75,26 +75,22 @@@ public class ModifyOfferGUI extends JFr
                this.setSize(new Dimension(513, 433));
                this.setTitle("Set availability");
  
-               
-               jComboBox1 = new JComboBox<RuralHouse>(v);
 -<<<<<<< HEAD
+               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();
 -              }
 -=======
 ->>>>>>> 25898b619dd708c9f15a44200b545cac11404b73
 -              
++              }               
+               jComboBox1 = new JComboBox<RuralHouse>(Hlist);
  
                comboBox_o = new JComboBox<Offer>(
                                ((RuralHouse) jComboBox1.getSelectedItem()).getAllOffers());
  
                        @Override
                        public void itemStateChanged(ItemEvent arg0) {
-                               Vector<Offer> vo = ((RuralHouse) jComboBox1.getSelectedItem()).getAllOffers();
++
+                               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 (!((RuralHouse) jComboBox1.getSelectedItem()).getAllOffers()
-                                               .isEmpty()) {
+                               if (!vo.isEmpty()) {
                                        jCalendar1.setEnabled(true);
                                        jCalendar2.setEnabled(true);
                                        jButton1.setEnabled(true);
@@@ -6,9 -4,7 +6,8 @@@ 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.Date;
  import java.util.Enumeration;
  import java.util.Vector;
  
@@@ -23,8 -18,7 +22,8 @@@ import javax.swing.table.DefaultTableCe
  import javax.swing.table.DefaultTableModel;
  
  import common.BookingInterface;
- import common.OfferInterface;
 +import configuration.___IntNames;
  import domain.Booking;
  import domain.Offer;
  
@@@ -5,12 -5,10 +5,12 @@@ 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;
  import dataAccess.DB4oManager;
  import domain.Booking;
  import domain.Client;
@@@ -3,8 -3,8 +3,6 @@@ package common
  import java.rmi.Remote;
  import java.rmi.RemoteException;
  
--import domain.Account;
--
  public interface AccountInterface extends Remote{
        
  
Simple merge
@@@ -14,9 -14,8 +14,10 @@@ public class RuralHouse implements Seri
        private Owner owner;
        private String district;
        private HouseFeatures features;
 -      public Vector<Offer> offers;
 +      private Vector<Offer> offers;
 +      private boolean isAccepted;
 +
        public RuralHouse() {
                super();
        }