The bug found in the presentation that we forgot to review has been fixed
[RRRRHHHH_Code] / ruralHouses / src / gui / OwnerRegistrationGUI.java
diff --git a/ruralHouses/src/gui/OwnerRegistrationGUI.java b/ruralHouses/src/gui/OwnerRegistrationGUI.java
deleted file mode 100644 (file)
index 62395d5..0000000
+++ /dev/null
@@ -1,170 +0,0 @@
-package gui;
-
-import java.awt.Color;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.rmi.Naming;
-import java.rmi.RemoteException;
-
-import javax.swing.JButton;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-import javax.swing.border.EmptyBorder;
-
-import common.AdminInterface;
-
-import configuration.___IntNames;
-import domain.Owner;
-
-public class OwnerRegistrationGUI extends JFrame {
-
-       /**
-        * 
-        */
-       private static final long serialVersionUID = 1L;
-       private JPanel panel;
-       private JTextField nameField;
-       private JTextField userNameField;
-       private AdminInterface am = null;
-       private JTextField passField;
-       private JTextField bank1Field;
-       private JTextField bank2Field;
-       private JTextField bank3Field;
-       private JTextField bank4Field;
-       private JTextField emailField;
-       private JLabel lblWhenAcceptedYou;
-       private JLabel feedback;
-
-       /**
-        * Create the frame.
-        */
-       public OwnerRegistrationGUI() {
-
-               try {
-                       am = (AdminInterface) Naming.lookup(___IntNames.AdminManager);
-               } catch (Exception e1) {
-                       System.out.println("Error accessing remote authentication: "
-                                       + e1.toString());
-               }
-               setTitle("Owner registration");
-               setBounds(100, 100, 500, 400);
-               panel = new JPanel();
-               panel.setBorder(new EmptyBorder(5, 5, 5, 5));
-               setContentPane(panel);
-               panel.setLayout(null);
-
-               JLabel nameLb = new JLabel("Name:");
-               nameLb.setBounds(37, 45, 46, 14);
-               panel.add(nameLb);
-
-               nameField = new JTextField();
-               nameField.setBounds(147, 42, 86, 20);
-               panel.add(nameField);
-               nameField.setColumns(10);
-
-               JLabel lblUsername = new JLabel("Username:");
-               lblUsername.setBounds(37, 212, 69, 14);
-               panel.add(lblUsername);
-
-               userNameField = new JTextField();
-               userNameField.setBounds(147, 209, 86, 20);
-               panel.add(userNameField);
-               userNameField.setColumns(10);
-
-               JLabel lblPassword = new JLabel("Password:");
-               lblPassword.setBounds(37, 258, 69, 14);
-               panel.add(lblPassword);
-
-               passField = new JTextField();
-               passField.setBounds(147, 255, 86, 20);
-               panel.add(passField);
-               passField.setColumns(10);
-
-               JLabel lblBankAccount = new JLabel("Bank account:");
-               lblBankAccount.setBounds(37, 94, 69, 14);
-               panel.add(lblBankAccount);
-
-               bank1Field = new JTextField();
-               bank1Field.setBounds(147, 91, 61, 20);
-               panel.add(bank1Field);
-
-               bank2Field = new JTextField();
-               bank2Field.setBounds(218, 91, 61, 20);
-               panel.add(bank2Field);
-
-               bank3Field = new JTextField();
-               bank3Field.setBounds(289, 91, 32, 20);
-               panel.add(bank3Field);
-
-               bank4Field = new JTextField();
-               bank4Field.setBounds(331, 91, 117, 20);
-               panel.add(bank4Field);
-
-               JButton btnSendRegistrationRequest = new JButton(
-                               "Send registration request");
-               btnSendRegistrationRequest.setBounds(127, 316, 194, 23);
-               btnSendRegistrationRequest.addActionListener(new ActionListener() {
-                       public void actionPerformed(ActionEvent arg0) {
-
-                               jButton_ActionPerformed(arg0);
-                       }
-               });
-
-               panel.add(btnSendRegistrationRequest);
-
-               JLabel lblEmail = new JLabel("E-mail:");
-               lblEmail.setBounds(37, 155, 46, 14);
-               panel.add(lblEmail);
-
-               emailField = new JTextField();
-               emailField.setBounds(147, 152, 148, 20);
-               panel.add(emailField);
-               emailField.setColumns(10);
-
-               lblWhenAcceptedYou = new JLabel(
-                               "When accepted you will receive an e-mail");
-               lblWhenAcceptedYou.setForeground(Color.GREEN);
-               lblWhenAcceptedYou.setBounds(127, 291, 214, 14);
-               panel.add(lblWhenAcceptedYou);
-
-               feedback = new JLabel("");
-               feedback.setForeground(Color.RED);
-               feedback.setEnabled(false);
-               feedback.setBounds(127, 344, 214, 20);
-               panel.add(feedback);
-       }
-
-       private void jButton_ActionPerformed(ActionEvent e) {
-
-               if (!emailField
-                               .getText()
-                               .matches(
-                                               "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$")
-                               || !this.nameField.getText().isEmpty()||this.bank1Field.getText().length()!=4 || this.bank2Field.getText().length()!=4
-                               ||this.bank3Field.getText().length()!=2 || this.bank4Field.getText().length()!=10) {
-                       Owner own = new Owner(this.nameField.getText(),
-                                       this.bank1Field.getText() + " " + this.bank2Field.getText()
-                                                       + " " + this.bank3Field.getText() + " "
-                                                       + this.bank4Field.getText(),
-                                       this.emailField.getText());
-
-                       try {
-                               if (this.am.addAccountRequest(this.userNameField.getText(),
-                                               this.passField.getText(), own)) {
-                                       this.am.saveInstance();
-                                       this.feedback.setText("Request sended");
-                               } else {
-                                       this.feedback.setText("Can't send the request");
-                               }
-                       } catch (RemoteException e1) {
-                               // TODO Auto-generated catch block
-                               e1.printStackTrace();
-                       }
-               } else {
-                       this.feedback.setText("Bad formatted data");
-               }
-
-       }
-}