import javax.swing.JTextPane;
+import businessLogic.AdminManager;
import businessLogic.HouseManager;
import businessLogic.HouseManagerInterface;
-public class NewHouseGUI extends JFrame {
+public class RequestNewHouseGUI extends JFrame {
/**
*
private JLabel lblBaths;
private JTextField baths_f;
private JButton btnRegister;
+ private AdminManager am;
/**
* Create the frame.
*/
- public NewHouseGUI(Owner o) {
+ public RequestNewHouseGUI(Owner o) {
+
+ am = new AdminManager();
this.setTitle("New House");
setBackground(Color.WHITE);
this.getContentPane().setLayout(null);
baths_f = new JTextField();
baths_f.setColumns(10);
- btnRegister = new JButton("Register House");
+ btnRegister = new JButton("Request registration");
btnRegister.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
+ RuralHouse rh = null;
try {
- HouseManagerInterface hm = new HouseManager();
//TODO when the house is not added show a warning to the user. Method below returns a boolean stating that.
- hm.registerNewHouse(Code_f.getText(),
+ rh = new RuralHouse(Code_f.getText(),
owner, description_f.getText(),
- Town_f.getText() ,Integer.parseInt(rooms_f.getText()),
+ Town_f.getText() ,new HouseFeatures(Integer.parseInt(rooms_f.getText()),
Integer.parseInt(kitchens_f.getText()),
Integer.parseInt(baths_f.getText()),
Integer.parseInt(lRooms_f.getText()),
- Integer.parseInt(parkings_f.getText()) );
+ Integer.parseInt(parkings_f.getText())) );
}
catch(NumberFormatException e ){
e.printStackTrace();
}
+
+ am.addAdditionRequest(rh);
}
});
GroupLayout gl_contentPane = new GroupLayout(contentPane);