|
@@ -5,6 +5,7 @@ |
5 |
5 |
|
import java.awt.event.ItemEvent; |
6 |
6 |
|
import java.awt.event.ItemListener; |
7 |
7 |
|
import java.rmi.Naming; |
|
8 |
+ |
import java.rmi.RemoteException; |
8 |
9 |
|
import java.util.Vector; |
9 |
10 |
|
|
10 |
11 |
|
import javax.swing.JButton; |
|
@@ -15,6 +16,7 @@ |
15 |
16 |
|
import javax.swing.JRadioButton; |
16 |
17 |
|
import javax.swing.border.EmptyBorder; |
17 |
18 |
|
|
|
19 |
+ |
import common.HouseInterface; |
18 |
20 |
|
import common.OfferInterface; |
19 |
21 |
|
|
20 |
22 |
|
import configuration.___IntNames; |
|
@@ -29,28 +31,40 @@ |
29 |
31 |
|
*/ |
30 |
32 |
|
private static final long serialVersionUID = 1L; |
31 |
33 |
|
private JPanel contentPane; |
32 |
|
- |
private Owner owner; |
33 |
34 |
|
private JLabel feedback; |
34 |
35 |
|
private JComboBox<RuralHouse> comboBox; |
35 |
36 |
|
private JComboBox<Offer> comboBox_1; |
36 |
37 |
|
private JButton btnDelete; |
|
38 |
+ |
private Vector<RuralHouse> Hlist = null; |
|
39 |
+ |
private HouseInterface hm = null; |
37 |
40 |
|
|
38 |
41 |
|
/** |
39 |
42 |
|
* Create the frame. |
40 |
43 |
|
*/ |
41 |
44 |
|
public DeleteOfferGUI(Owner o) { |
42 |
|
- |
this.owner = o; |
|
45 |
+ |
try { |
|
46 |
+ |
hm = (HouseInterface) Naming |
|
47 |
+ |
.lookup(___IntNames.HouseManager); |
|
48 |
+ |
} catch (Exception e1) { |
|
49 |
+ |
System.out.println("Error accessing remote authentication: " |
|
50 |
+ |
+ e1.toString()); |
|
51 |
+ |
} |
|
52 |
+ |
try { |
|
53 |
+ |
Hlist = hm.getHouses(o, null, null, 0, 0, 0, 0, 0); |
|
54 |
+ |
} catch (RemoteException e1) { |
|
55 |
+ |
e1.printStackTrace(); |
|
56 |
+ |
} |
43 |
57 |
|
setBounds(100, 100, 450, 300); |
44 |
58 |
|
contentPane = new JPanel(); |
45 |
59 |
|
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); |
46 |
60 |
|
setContentPane(contentPane); |
47 |
61 |
|
|
48 |
|
- |
comboBox = new JComboBox<RuralHouse>(this.owner.getRuralHouses()); |
|
62 |
+ |
comboBox = new JComboBox<RuralHouse>(this.Hlist); |
49 |
63 |
|
comboBox.setBounds(101, 38, 314, 20); |
50 |
64 |
|
|
51 |
65 |
|
comboBox_1 = new JComboBox<Offer>(); |
52 |
66 |
|
comboBox_1.setBounds(101, 76, 314, 20); |
53 |
|
- |
Vector<Offer> vo = ((RuralHouse) comboBox.getSelectedItem()).offers; |
|
67 |
+ |
Vector<Offer> vo = ((RuralHouse) comboBox.getSelectedItem()).getAllOffers(); |
54 |
68 |
|
comboBox_1.removeAllItems(); |
55 |
69 |
|
for (Offer of : vo) { |
56 |
70 |
|
comboBox_1.addItem(of); |
|
@@ -68,7 +82,7 @@ |
68 |
82 |
|
|
69 |
83 |
|
@Override |
70 |
84 |
|
public void itemStateChanged(ItemEvent arg0) { |
71 |
|
- |
Vector<Offer> vo = ((RuralHouse) comboBox.getSelectedItem()).offers; |
|
85 |
+ |
Vector<Offer> vo = ((RuralHouse) comboBox.getSelectedItem()).getAllOffers(); |
72 |
86 |
|
comboBox_1.removeAllItems(); |
73 |
87 |
|
for (Offer of : vo) { |
74 |
88 |
|
comboBox_1.addItem(of); |