Git Repository Public Repository

RRRRHHHH_Code

URLs

Copy to Clipboard
 
d7fd1754bcc5ee9a9e87e27c0fde6c2b020f4bfd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
package gui;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;

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 businessLogic.HouseManager;
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())));
				HouseManager hm = new HouseManager();

				if (hm.registerNewHouse(newRh)) {
					owner.getRuralHouses().add(newRh);
					houseBox.removeItem(rh);
					feedback.setText("House properly modified");
				} else
					feedback.setText("Imposible to modify the house");

			}
		});

		houseBox = new JComboBox<RuralHouse>(o.getRuralHouses());
		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);
	}
}

Commits for RRRRHHHH_CoderuralHouses/src/gui/ModifyHouseGUI.java

Diff revisions: vs.
Revision Author Commited Message
d7fd17 ... Diff Diff Eneko Pinzolas Murua Mon 27 Apr, 2015 12:01:38 +0000

Started creating the booking interface for the owners.

153110 ... Diff Diff Eneko Pinzolas Murua Sun 19 Apr, 2015 21:47:53 +0000

debugging

42679b ... Diff Diff pinene picture pinene Sun 19 Apr, 2015 14:18:02 +0000

Merge branch ‘master’ of https://xp-dev.com/git/RRRRHHHH_Code

Conflicts:
ruralHouses/src/businessLogic/OfferManager.java
ruralHouses/src/gui/HouseFeaturesGUI.java
ruralHouses/src/gui/ModifyHouseGUI.java
ruralHouses/src/gui/StartWindow.java

520867 ... Diff Diff pinene picture pinene Sun 19 Apr, 2015 14:09:12 +0000

tmp

837fab ... Diff Diff Eneko Pinzolas Murua Sat 18 Apr, 2015 14:09:49 +0000

no warnings

d5b843 ... Diff Diff Eneko Pinzolas Murua Sat 18 Apr, 2015 14:01:54 +0000

last version with phone regex

46d6c3 ... Diff Diff camjan Wed 15 Apr, 2015 17:08:42 +0000

Debbugin continues...

ba6020 ... Diff Diff camjan Wed 15 Apr, 2015 15:47:17 +0000

Merge branch ‘master’ of https://xp-dev.com/git/RRRRHHHH_Code

Conflicts:
ruralHouses/src/dataAccess/DB4oManager.java
ruralHouses/src/gui/ModifyHouseGUI.java

5761bc ... Diff Diff camjan Wed 15 Apr, 2015 15:27:07 +0000

Bugs when deleting houses and offers fixed and GUI’s adapated for empty cases

2ac167 ... Eneko Pinzolas Murua Wed 15 Apr, 2015 13:53:44 +0000

admin completed