ATM system Implementation [4]--Account Selection window [00 original]

Source: Internet
Author: User
Tags visibility
Package cn.edu.ynu.sei.atm.client.ui;

Import Cn.edu.ynu.sei.atm.interfaceDef.IAvailableAccount;
Import Cn.edu.ynu.sei.atm.interfaceDef.IBankAccount;
Import java.rmi.Naming;
Import java.rmi.RemoteException;
Import Org.eclipse.swt.SWT;
Import Org.eclipse.swt.events.MouseAdapter;
Import org.eclipse.swt.events.MouseEvent;
Import Org.eclipse.swt.events.SelectionAdapter;
Import org.eclipse.swt.events.SelectionEvent;
Import Org.eclipse.swt.widgets.Button;
Import Org.eclipse.swt.widgets.Composite;
Import Org.eclipse.swt.widgets.Label;
Import Org.eclipse.swt.widgets.MessageBox;

/**
* Account Selection Window container
* @author 88250
*/
public class Accountselectcomposite extends composite
{
/**
* OK button
*/
Private Button confirmbtn;

/**
* Current Account options
*/
Private Button Curaccountradio;

/**
* Credit Card account options
*/
Private Button Credaccountradio;

/**
* Recurring Account Options
*/
Private Button Depaccountradio;

/**
* Prompt to select Account Label
*/
Private Label Pleaseselectlbl;

/**
* Available Account Instances
*/
Private Iavailableaccount availableaccount = null;

/**
* Parent Window Container
*/
Private composite parent = NULL;

/**
* Service Selection window container
*/
Private Serviceselectcomposite SSC = null;

/**
* Account Operation Example
*/
public static Ibankaccount account = NULL;

/**
* Create an Account selection box instance to initialize the available account information
* @param parent window Container
* @param availableaccount Available account information
*/
Public Accountselectcomposite (composite parent,
Iavailableaccount Availableaccount)
{
Super (parent, SWT. NONE);
this. Parent = parent;
this. Availableaccount = Availableaccount;
Createcontents ();
}

/**
* Create account number Select the containing control of the window container
*/
private void Createcontents ()
{
Depaccountradio = new Button (parent, SWT. RADIO);
Depaccountradio.settext ("term account");
Depaccountradio.setbounds (59, 94, 98, 22);

Curaccountradio = new Button (parent, SWT. RADIO);
Curaccountradio.settext ("Current Account");
Curaccountradio.setbounds (59, 66, 98, 22);

Credaccountradio = new Button (parent, SWT. RADIO);
Credaccountradio.settext ("credit card Account");
Credaccountradio.setbounds (59, 120, 98, 22);

Setaccountsenabled ();

Curaccountradio.addselectionlistener (New Selectionadapter ()
{
public void widgetselected (Selectionevent e)
{
Confirmbtn.setenabled (TRUE);
Try
{
Account = (Ibankaccount) naming.lookup (
Logininterface.serviceaddr + "Currentaccount");
Account.setid (Availableaccount.getcurid ());
}
catch (RemoteException re)
{
MessageBox Exitdlg = new MessageBox (Parent.getshell ());
Exitdlg.settext ("Network connectivity problem ....") " );
Exitdlg.setmessage ("Cannot connect to the server.) " );
Exitdlg.open ();
System.exit (0);
Re.printstacktrace ();
}
catch (Exception ex)
{
Ex.printstacktrace ();
}
}
});
Credaccountradio.addselectionlistener (New Selectionadapter ()
{
public void widgetselected (Selectionevent e)
{
Confirmbtn.setenabled (TRUE);
Try
{
Account = (Ibankaccount) naming.lookup (
Logininterface.serviceaddr + "Creditaccount");
Account.setid (Availableaccount.getcredid ());
}
catch (RemoteException re)
{
MessageBox Exitdlg = new MessageBox (Parent.getshell ());
Exitdlg.settext ("Network connectivity problem ....") " );
Exitdlg.setmessage ("Cannot connect to the server, the system will exit.") " );
Exitdlg.open ();
System.exit (0);
Re.printstacktrace ();
}
catch (Exception ex)
{
Ex.printstacktrace ();
}

}
});
Depaccountradio.addselectionlistener (New Selectionadapter ()
{
public void widgetselected (Selectionevent e)
{
Confirmbtn.setenabled (TRUE);
Try
{
Account = (Ibankaccount) naming.lookup (
Logininterface.serviceaddr + "Depositaccount");
Account.setid (Availableaccount.getdepid ());
}
catch (RemoteException re)
{
MessageBox Exitdlg = new MessageBox (Parent.getshell ());
Exitdlg.settext ("Network connectivity problem ....") " );
Exitdlg.setmessage ("Cannot connect to the server, the system will exit.") " );
Exitdlg.open ();
System.exit (0);
Re.printstacktrace ();
}
catch (Exception ex)
{
Ex.printstacktrace ();
}

}
});
PLEASESELECTLBL = new Label (parent, SWT. NONE);
Pleaseselectlbl.settext ("Please select your account type:");
Pleaseselectlbl.setbounds (29, 41, 130, 15);
SSC = new Serviceselectcomposite (parent);
CONFIRMBTN = new Button (parent, SWT. NONE);
Confirmbtn.setenabled (FALSE);
Confirmbtn.addmouselistener (New Mouseadapter ()
{
public void MouseDown (MouseEvent arg0)
{//click OK button
Setcontentsvisible (FALSE);
Ssc.setcontentsvisible (TRUE);
}
});
SSC.GETRETURNBTN (). Addmouselistener (New Mouseadapter ()
{///Click the Back button in the Service Selection window container
public void MouseDown (MouseEvent e)
{
Ssc.setcontentsvisible (FALSE);
Setcontentsvisible (TRUE);
}
});
Confirmbtn.settext ("OK");
Confirmbtn.setbounds (191, 135, 51, 27);
}

/**
* Set the visibility of controls in the Available Account Selection window
* @param b Visibility
*/
private void Setcontentsvisible (Boolean b)
{
Confirmbtn.setvisible (b);
Credaccountradio.setvisible (b);
Curaccountradio.setvisible (b);
Depaccountradio.setvisible (b);
Pleaseselectlbl.setvisible (b);
}

/**
* Set up available account selections
*/
private void setaccountsenabled ()
{
Try
{
if (Availableaccount.getcurid ()!= 0)
{//Current account available

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.