ATM system implementation [8]--Transfer Inquiry window [00 original]
Last Update:2018-07-23
Source: Internet
Author: User
Package cn.edu.ynu.sei.atm.client.ui;
Import cn.edu.ynu.sei.atm.interfaceDef.ITransaction;
Import java.rmi.Naming;
Import java.rmi.RemoteException;
Import java.util.ArrayList;
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.Display;
Import Org.eclipse.swt.widgets.Label;
Import Org.eclipse.swt.widgets.MessageBox;
/**
* History Transaction Query window container
* @author 88250
*/
public class Transactionquerycomposite extends composite
{
/**
* Prompt to select the query way label
*/
Private Label PLEASESELECTCONDITIONLBL = null;
/**
* Last one months button
*/
Private Button latedmonthbtn = null;
/**
* OK button
*/
Private Button confirmbtn = null;
/**
* Recent Transaction Query button
*/
Private Button latedbtn = null;
/**
* Last year Transaction query button
*/
Private Button lastyearbtn = null;
/**
* Back button
*/
Private Button returnbtn = null;
/**
* Show Query Results window
*/
Private Transactionshowcomposite TSC = null;
/**
* Parent Window Container
*/
Private composite parent = NULL;
/**
* Transaction Service Interface
*/
Private ITransaction transaction = NULL;
/**
* Create a History transaction query window
*
* @param Parent
* Parent Window Container
*/
Public Transactionquerycomposite (composite parent)
{
Super (parent, SWT. NONE);
this. Parent = parent;
Createcontents ();
}
/**
* Create a History Transaction Query window container containing controls
*/
private void Createcontents ()
{
PLEASESELECTCONDITIONLBL = new Label (this, SWT. NONE);
Pleaseselectconditionlbl.settext ("Please select the query condition:");
Pleaseselectconditionlbl.setbounds (17, 22, 105, 20);
LATEDBTN = new Button (this, SWT. RADIO);
Latedbtn.addselectionlistener (New Selectionadapter ()
{
public void widgetselected (Selectionevent e)
{
Confirmbtn.setenabled (TRUE);
}
});
Latedbtn.settext ("recent transaction");
Latedbtn.setbounds (19, 50, 100, 22);
LATEDMONTHBTN = new Button (this, SWT. RADIO);
Latedmonthbtn.addselectionlistener (New Selectionadapter ()
{
public void widgetselected (Selectionevent e)
{
Confirmbtn.setenabled (TRUE);
}
});
Latedmonthbtn.settext ("Trading for nearly one months");
Latedmonthbtn.setbounds (19, 76, 100, 22);
LASTYEARBTN = new Button (this, SWT. RADIO);
Lastyearbtn.addselectionlistener (New Selectionadapter ()
{
public void widgetselected (Selectionevent e)
{
Confirmbtn.setenabled (TRUE);
}
});
Lastyearbtn.settext ("Nearly one year transaction");
Lastyearbtn.setbounds (19, 102, 100, 22);
RETURNBTN = new Button (this, SWT. NONE);
Returnbtn.setbackground (Display.getcurrent (). Getsystemcolor (
Swt. Color_white));
Returnbtn.settext ("return");
Returnbtn.setbounds (78, 144, 40, 30);
CONFIRMBTN = new Button (this, SWT. BORDER);
Confirmbtn.setenabled (FALSE);
TSC = new Transactionshowcomposite (parent);
Confirmbtn.addmouselistener (New Mouseadapter ()
{
public void MouseDown (MouseEvent arg0)
{
Try
{
ArrayList Dwal = null; Access to the list of records
ArrayList tal = null; Transfer record list
Transaction = (ITransaction) naming.lookup (logininterface.serviceaddr + "transaction");
if (Latedbtn.getselection ())
{
Dwal = Transaction.getdwinfolist (AccountSelectComposite.account.getID (), 0);
tal = Transaction.gettransferinfolist (AccountSelectComposite.account.getID (), 0);
Tsc.getwdlist (). RemoveAll ();
Tsc.gettransferlist (). RemoveAll ();
if (! Dwal.isempty ())
{
Tsc.getwdlist (). Add ((String) dwal.get (0));
}
if (! Tal.isempty ())
{
Tsc.gettransferlist (). Add ((String) tal.get (0));
}
}
else if (latedmonthbtn.getselection ())
{
Dwal = Transaction.getdwinfolist (AccountSelectComposite.account.getID (), 1);
tal = Transaction.gettransferinfolist (AccountSelectComposite.account.getID (), 1);
Tsc.getwdlist (). RemoveAll ();
Tsc.gettransferlist (). RemoveAll ();
for (int i = 0; i < dwal.size (); i + +)
{
Tsc.getwdlist (). Add ((String) dwal.get (i));
}
for (int i = 0; i < tal.size (); i + +)
{
Tsc.gettransferlist (). Add ((String) tal.get (i));
}
}
else if (lastyearbtn.getselection ())
{
Dwal = Transaction.getdwinfolist (AccountSelectComposite.account.getID (), 2);
tal = Transaction.gettransferinfolist (AccountSelectComposite.account.getID (), 2);
Tsc.getwdlist (). RemoveAll ();
Tsc.gettransferlist (). RemoveAll ();
for (int i = 0; i < dwal.size (); i + +)
{
Tsc.getwdlist (). Add ((String) dwal.get (i));
}
for (int i = 0; i < tal.size (); i + +)
{
Tsc.gettransferlist (). Add ((String) tal.get (i));
}
}
}
catch (RemoteException re)
{
Re.printstacktrace ();
MessageBox Exitdlg = new MessageBox (Parent.getshell ());
Exitdlg.settext ("