Git Repository Public Repository

RRRRHHHH_Code

URLs

Copy to Clipboard
 
d30bcc8a3c13bbf5144b03a644c1345865aed708
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
package gui;

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.DefaultTableModel;

import domain.RuralHouse;

public class listOfHousesGUI extends JFrame {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private JPanel contentPane;
	private JTable table;
	private DefaultTableModel tableModel;
	private Vector<RuralHouse> houses;
 	/**
	 * Create the frame.
	 */
	public listOfHousesGUI(Vector<RuralHouse> rhs) {
		try {
			this.houses=rhs;
			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 matching your search");
		else
			lblNewLabel.setText("List of houses that match your search:");
		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);
		Enumeration<RuralHouse> en = houses.elements();
		RuralHouse rh;
		table.addMouseListener( new MouseAdapter(){			
			@Override
			public void mouseClicked(MouseEvent arg0) {
				int row = table.getSelectedRow();
				HouseFeaturesGUI feat = new HouseFeaturesGUI(houses.get(row),null,null);
				feat.setVisible(true);
			}
		});
		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);
		}

	}
}

Commits for RRRRHHHH_CoderuralHouses/src/gui/listOfHousesGUI.java

Diff revisions: vs.
Revision Author Commited Message
d30bcc ... Diff Diff pinene picture pinene Wed 20 May, 2015 16:32:33 +0000

cleaning

4f8bcc ... Diff Diff epinzolas001 Mon 18 May, 2015 09:49:54 +0000

Merge conflicts solutioned

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

tmp

e2ae30 ... Diff Diff Eneko Pinzolas Murua Tue 14 Apr, 2015 15:07:35 +0000

imports leaned

045820 ... Diff Diff Eneko Pinzolas Murua Fri 10 Apr, 2015 10:37:22 +0000

Minor error correction and some bugs, alongside with modify offers quality of life improvements.

3e4f7e ... Diff Diff camjan Wed 08 Apr, 2015 13:18:53 +0000

New GUI for booking and querying availability

cff7b0 ... Diff Diff camjan Wed 08 Apr, 2015 11:57:07 +0000

House features gui created

5ad0cc ... Diff Diff Eneko Pinzolas Murua Wed 01 Apr, 2015 17:46:59 +0000

ModifyHouseGUI created and its link from HouseRelatedOwnerGUI reestablished

afdc66 ... Diff Diff camjan Wed 25 Mar, 2015 16:43:35 +0000

Villatripas de arriba districs added and the option of searching houses with diferent parameters

5dd541 ... camjan Wed 11 Mar, 2015 22:59:01 +0000

GUI added to show list of available houses