Git Repository Public Repository

RRRRHHHH_Code

URLs

Copy to Clipboard

Diff Revisions ccac99 ... vs be3833 ... for ruralHouses client/src/gui/listOfOffers.java

Diff revisions: vs.
  @@ -6,6 +6,8 @@
6 6 import java.awt.Rectangle;
7 7 import java.awt.event.MouseAdapter;
8 8 import java.awt.event.MouseEvent;
9 + import java.rmi.Naming;
10 + import java.rmi.RemoteException;
9 11 import java.util.Enumeration;
10 12 import java.util.Vector;
11 13
  @@ -18,6 +20,10 @@
18 20 import javax.swing.table.DefaultTableCellRenderer;
19 21 import javax.swing.table.DefaultTableModel;
20 22
23 + import common.HouseInterface;
24 + import common.OfferInterface;
25 +
26 + import configuration.___IntNames;
21 27 import domain.Offer;
22 28 import domain.Owner;
23 29 import domain.RuralHouse;
  @@ -56,8 +62,23 @@
56 62 setContentPane(contentPane);
57 63 contentPane.setLayout(null);
58 64 this.offers = new Vector<Offer>();
59 - for (RuralHouse rh: this.owner.getRuralHouses()){
60 - this.offers.addAll(rh.getAllOffers());
65 + HouseInterface hm = null;
66 + try {
67 + hm = (HouseInterface) Naming
68 + .lookup(___IntNames.HouseManager);
69 + } catch (Exception e1) {
70 + System.out.println("Error accessing remote authentication: "
71 + + e1.toString());
72 + }
73 + Vector<RuralHouse> Hlist = null;
74 + try {
75 + Hlist = hm.getHouses(owner, null, null, 0, 0, 0, 0, 0);
76 + } catch (RemoteException e1) {
77 + e1.printStackTrace();
78 + }
79 + for (RuralHouse rh: Hlist){
80 + for(Offer of : rh.getAllOffers())
81 + this.offers.add(of);
61 82 }
62 83 JLabel lblNewLabel = new JLabel();
63 84 lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 27));
  @@ -85,13 +106,12 @@
85 106 tableModel = new DefaultTableModel(null, new String[] { "Offer #",
86 107 "FirstDay", "LastDay", "Price" ,"RuralHouse"});
87 108
88 - // Maybe there is a better way to avoid interaction.
89 - // table.setEnabled(false);
90 109 table.setModel(tableModel);
91 110 table.addMouseListener( new MouseAdapter(){
92 111 @Override
93 112 public void mouseClicked(MouseEvent arg0) {
94 113 int row = table.getSelectedRow();
114 + System.out.println(row);
95 115 listOfBookingRequestsGUI feat = new listOfBookingRequestsGUI(offers.get(row));
96 116 feat.setVisible(true);
97 117 }