Git Repository Public Repository

RRRRHHHH_Code

URLs

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

import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.Vector;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JComboBox;
import javax.swing.JRadioButton;
import javax.swing.JButton;

import businessLogic.AdminManager;
import businessLogic.HouseManager;
import businessLogic.HouseManagerInterface;
import domain.Owner;
import domain.RuralHouse;

public class RequestDeleteHouseGUI extends JFrame {

	private JPanel contentPane;
	private Owner owner;
	private JComboBox comboBox;
	private JButton btnDelete;
	private AdminManager am;

	/**
	 * Create the frame.
	 */
	public RequestDeleteHouseGUI(Owner o) {
		am  = new AdminManager();
		this.owner = o;
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
	
		comboBox = new JComboBox(this.owner.getRuralHouses());
		

		JRadioButton rdbtnIAmSure = new JRadioButton("I am sure");
		
		btnDelete = new JButton("REQUEST");
		btnDelete.setEnabled(false);
		
		rdbtnIAmSure.addItemListener(new ItemListener() {

			@Override
			public void itemStateChanged(ItemEvent e) {
				int state = e.getStateChange();
				if (state == ItemEvent.SELECTED){
					btnDelete.setEnabled(true);
				}
				else if (state == ItemEvent.DESELECTED){
					btnDelete.setEnabled(false);
				}
			}
		});
		
		GroupLayout gl_contentPane = new GroupLayout(contentPane);
		gl_contentPane.setHorizontalGroup(
			gl_contentPane.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_contentPane.createSequentialGroup()
					.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
						.addGroup(gl_contentPane.createSequentialGroup()
							.addGap(70)
							.addComponent(comboBox, GroupLayout.PREFERRED_SIZE, 332, GroupLayout.PREFERRED_SIZE))
						.addGroup(gl_contentPane.createSequentialGroup()
							.addGap(85)
							.addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
								.addComponent(btnDelete)
								.addComponent(rdbtnIAmSure))))
					.addContainerGap(954, Short.MAX_VALUE))
		);
		gl_contentPane.setVerticalGroup(
			gl_contentPane.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_contentPane.createSequentialGroup()
					.addGap(50)
					.addComponent(comboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
					.addGap(68)
					.addComponent(rdbtnIAmSure)
					.addGap(47)
					.addComponent(btnDelete)
					.addContainerGap(493, Short.MAX_VALUE))
		);
		contentPane.setLayout(gl_contentPane);
		
		btnDelete.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				actionListenerButton(arg0);
				
			}

			
		});
	}
	
	private void actionListenerButton(ActionEvent e){
		RuralHouse toDel = (RuralHouse)comboBox.getSelectedItem();
		
		am.addDeletionRequest(toDel);
	}
}

Commits for RRRRHHHH_CoderuralHouses/src/gui/RequestDeleteHouseGUI.java

Diff revisions: vs.
Revision Author Commited Message
66f0c8 ... Eneko Pinzolas Murua Sun 12 Apr, 2015 18:11:42 +0000

Model modified so that owners now request for a new house insetion or a house removal. Furthermore, all Administrator GUI and bussines logic create. However, Login GUI and BussinesLogic are to be modified so that they integrate Admin identification.