if(jfcExport.getSelectedFile()==null)
return;
File fleInput=jfcExport.getSelectedFile();
if(!jfcExport.getSelectedFile().exists())
{
OKMessage okm=new OKMessage(mwcMain, "The selected file does not exist!");
okm.setVisible(true);
okm=null;
return;
}
IniHolder.WriteValue("ImportWorkDir", jfcExport.getSelectedFile().getAbsolutePath().substring(0, jfcExport.getSelectedFile().getAbsolutePath().lastIndexOf((int)File.separatorChar)));
FileInputStream fisReader;
InputStreamReader isrReader;
BufferedReader brReader;
try
{
fisReader=new FileInputStream(fleInput);
isrReader=new InputStreamReader(fisReader);
brReader=new BufferedReader(isrReader);
Vector<Transaction> vctTrans=new Vector<Transaction>();
String s=brReader.readLine();
while(s!=null)
{
Transaction trans=Parse(s);
if(trans==null)
throw new IOException("Invalid file format!");
vctTrans.add(trans);
s=null;
s=brReader.readLine();
}
for(Iterator<Transaction> i=vctTrans.iterator(); i.hasNext();)
{
//Transaction trans=i.next();
//System.out.println("--------------");
//System.out.println(trans.amount);
mwcMain.getSelectedTab().addTransaction(i.next());
//mwcMain.getSelectedTab().addTransaction(trans);
//System.out.println(((CardPaneController)mwcMain.getSelectedTab()).getCard().getBalance());
//System.out.println("--------------");
}
fisReader.close();
isrReader.close();
brReader.close();
}
catch(IOException ex)
{
OKMessage okm=new OKMessage(mwcMain, "Unable to read the file or invalid file format!");
okm.setVisible(true);
}
}