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.JTextField;
import javax.swing.border.EmptyBorder;
-import businessLogic.AdminManager;
-import domain.Account;
+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 AdminManager am = new AdminManager();
+ private AdminInterface am = null;
private JTextField passField;
private JTextField bank1Field;
private JTextField bank2Field;
* 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();
this.bank1Field.getText() + " " + this.bank2Field.getText()
+ " " + this.bank3Field.getText() + " "
+ this.bank4Field.getText(), this.emailField.getText());
- Account acc = new Account(this.userNameField.getText(),
- this.passField.getText(), own);
- if (this.am.addAccount(acc)) {
- this.feedback.setText("Request sended");
- } else {
- this.feedback.setText("Can't send the request");
+
+ 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();
}
}