Package Messages

Examples of Messages.OKMessage


        double dblTotal=0;
        while(enCards.hasMoreElements())
        {
            dblTotal+=enCards.nextElement().getBalance();
        }
        OKMessage okm=new OKMessage(mwcMain, "<html><body>You have <b>"+dfCurrency.format(dblTotal)+"$</b> on all your cards.</body></html>");
        okm.setTitle(virtualcache.Main.ApplicationName);
        okm.setVisible(true);
        okm.dispose();
        okm=null;
    }
View Full Code Here


        {
            IniHolder.WriteValue("DataWorkDir", fdOpen.getSelectedFile().getAbsolutePath().substring(0, fdOpen.getSelectedFile().getAbsolutePath().lastIndexOf((int)File.separatorChar)));
            File fleOpened=fdOpen.getSelectedFile();
            if(!fleOpened.exists())
            {
                OKMessage okm=new OKMessage(mwcMain, "File "+fleOpened.getName()+" was not found!");
                okm.setVisible(true);
                okm=null;
                return;
            }
            Password pcPass=new Password(mwcMain);
            pcPass.setVisible(true);
            if(pcPass.getPassword()!=null)
            {
                mwcMain.CloseDatabase();
                Profile prfMain=(new FileReader(fleOpened)).read(pcPass.getPassword());
                if(prfMain!=null)
                {
                    prfMain.resetModifyed();
                    mwcMain.setProfile(prfMain);
                    mwcMain.setOpenedFile(fleOpened);
                    mwcMain.setPassword(pcPass.getPassword());
                }
                else
                {
                    OKMessage okm=new OKMessage(mwcMain, "Incorrect password or broken file!");
                    okm.setVisible(true);
                    okm=null;
                }
            }
            pcPass.erasePass();
            pcPass=null;
View Full Code Here

        rcHost=host;
        mwcMain=(MainWindowController)rcHost.getOwner();
    }
    public void actionPerformed(ActionEvent e)
    {
        OKMessage okm;
        Date dtBegin;
        Date dtEnd;
        dtBegin=ReadDate("01."+rcHost.txtFrom.getText());
        if(dtBegin==null)
        {
            okm=new OKMessage(mwcMain, "The filed \"From\" should contain date in format MM.yyyy!");
            okm.setVisible(true);
            return;
        }
        dtEnd=ReadDate("01."+rcHost.txtTo.getText());
        if(dtEnd==null)
        {
            okm=new OKMessage(mwcMain, "The filed \"To\" should contain date in format MM.yyyy!");
            okm.setVisible(true);
            return;
        }
        if(dtBegin.after(dtEnd))
        {
            okm=new OKMessage(mwcMain, "The date in field \"From\" should be fewer then \"To\"!");
            okm.setVisible(true);
            return;
        }
        Enumeration<String> enReasons=rcHost.getNewReasons().keys();
        while(enReasons.hasMoreElements())
        {
View Full Code Here

                    mwcMain.getSelectedTab().UpdateBalance();
                    blnGotResponse=true;
                }
                catch(NumberFormatException ex)
                {
                    OKMessage okm=new OKMessage(mwcMain, "<html><body>Initial Balance field should contain a numeric value in ###.## format!</body></html>");
                    okm.setVisible(true);
                    okm=null;
                    ibNewBalance=null;
                    nfDec=null;
                }
            }
View Full Code Here

        if(ynmcQuestion.getResult()==YesNoCancelMessage.YES)
        {
            Eraser er=new Eraser(mwcHost.getOpenedFile());
            if(!er.Erase())
            {
                OKMessage okm=new OKMessage(mwcHost, "Unavble to delete file!");
                okm.setVisible(true);
                okm=null;
            }
            else
            {
                mwcHost.getProfile().resetModifyed();
View Full Code Here

                if(!blnEquals)
                    break;
            }
        if(!blnEquals)
        {
            OKMessage okm=new OKMessage(mwcMain, "IncorrectPassword!");
            okm.setVisible(true);
            okm=null;
            return;
        }
        pswPass=null;
        String strDirrectory=IniHolder.ReadValue("ExportWorkDir");
        if(strDirrectory==null)
        {
            if(System.getenv("HOMEPATH")!=null)
                strDirrectory=new String(System.getenv("HOMEPATH")+"\\My Documents");
            else
                strDirrectory=new String(System.getenv("HOME"));
        }
        JFileChooser jfcExport=new JFileChooser(strDirrectory);
        jfcExport.addChoosableFileFilter(new FileFilterImpl("csv", "Text file"));
        //jfcExport.addChoosableFileFilter(new FileFilterImpl("txt", "Text file"));
        int intResult=jfcExport.showSaveDialog(mwcMain);
        if(intResult!=JFileChooser.APPROVE_OPTION)
            return;
        IniHolder.WriteValue("ExportWorkDir", jfcExport.getSelectedFile().getAbsolutePath().substring(0, jfcExport.getSelectedFile().getAbsolutePath().lastIndexOf((int)File.separatorChar)));
        File fleOutput=jfcExport.getSelectedFile();
        if(!jfcExport.getSelectedFile().exists())
        {
            if((!jfcExport.getSelectedFile().getName().toLowerCase().endsWith(".csv"))&&(!(new File(jfcExport.getSelectedFile().getName()+".csv")).exists()))
                fleOutput=new File(jfcExport.getSelectedFile().getAbsolutePath()+".csv");
        }
        else
        {
           
            YesNoCancelMessage ynmDelete=new YesNoCancelMessage(mwcMain, mwcMain.getTitle(), "The file already exists would you like to replace it?", false);
            ynmDelete.setVisible(true);
            if(ynmDelete.getResult()==YesNoCancelMessage.NO)
            {
                ynmDelete=null;
                jfcExport=null;
                return;
            }
        }
        FileOutputStream fosWriter;
        StringBuffer sbString=new StringBuffer();
        try
        {
            fosWriter=new FileOutputStream(fleOutput);
            DefaultTableModel dtmTrans=(DefaultTableModel)mwcMain.getCurrentTransactionTable().getModel();
            for(int i=0; i<dtmTrans.getRowCount(); i++)
            {
                for(int j=0; j<dtmTrans.getColumnCount(); j++)
                {
                    if(j==0)
                        continue;
                    if(j!=1)
                        sbString.append("\"");
                    if(j==2)
                        sbString.append(-Double.parseDouble(dtmTrans.getValueAt(i, j).toString()));
                    else
                        sbString.append(dtmTrans.getValueAt(i, j));
                    if(j!=1)
                        sbString.append("\"");
                    if(j!=dtmTrans.getColumnCount()-1)
                        sbString.append(',');
                }
                sbString.append('\n');
                fosWriter.write(sbString.toString().getBytes());
                sbString.delete(0, sbString.length());
            }
        }
        catch(IOException ex)
        {
            OKMessage okm=new OKMessage(mwcMain, "Unable to write file to disk!");
            okm.setVisible(true);
            okm=null;
        }
        finally
        {
            fosWriter=null;
View Full Code Here

                    }
                    fwDBWriter=new FileWriter(fdCreate.getSelectedFile(), prfMain);
                }
                if(!fwDBWriter.write(pcPass.getPassword()))
                {
                    OKMessage okError=new OKMessage(mwcMain, "The error occured while writing the file!");
                    okError.setVisible(true);
                    okError=null;
                }
                else
                {
                    mwcMain.setPassword(pcPass.getPassword());
View Full Code Here

        }
        return dblValid;
    }
    private void Report(String report)
    {
        OKMessage okm=new OKMessage(mwcHost, "<html><body>"+report+"</body></html>");
        okm.setVisible(true);
        okm=null;
    }
View Full Code Here

                if(!blnEquals)
                    break;
            }
        if(!blnEquals)
        {
            OKMessage okm=new OKMessage(mwcMain, "IncorrectPassword!");
            okm.setVisible(true);
            okm=null;
            return;
        }
        pswPass=null;
        String strDirrectory=IniHolder.ReadValue("ExportWorkDir");
        if(strDirrectory==null)
        {
            if(System.getenv("HOMEPATH")!=null)
                strDirrectory=new String(System.getenv("HOMEPATH")+"\\My Documents");
            else
                strDirrectory=new String(System.getenv("HOME"));
        }
        JFileChooser jfcExport=new JFileChooser(strDirrectory);
        jfcExport.addChoosableFileFilter(new FileFilterImpl("csv", "Text file"));
        //jfcExport.addChoosableFileFilter(new FileFilterImpl("txt", "Text file"));
        int intResult=jfcExport.showSaveDialog(mwcMain);
        if(intResult!=JFileChooser.APPROVE_OPTION)
            return;
        IniHolder.WriteValue("ExportWorkDir", jfcExport.getSelectedFile().getAbsolutePath().substring(0, jfcExport.getSelectedFile().getAbsolutePath().lastIndexOf((int)File.separatorChar)));
        File fleOutput=jfcExport.getSelectedFile();
        if(!jfcExport.getSelectedFile().exists())
        {
            if((!jfcExport.getSelectedFile().getName().toLowerCase().endsWith(".csv"))&&(!(new File(jfcExport.getSelectedFile().getName()+".csv")).exists()))
                fleOutput=new File(jfcExport.getSelectedFile().getAbsolutePath()+".csv");
        }
        else
        {
           
            YesNoCancelMessage ynmDelete=new YesNoCancelMessage(mwcMain, mwcMain.getTitle(), "The file already exists would you like to replace it?", false);
            ynmDelete.setVisible(true);
            if(ynmDelete.getResult()==YesNoCancelMessage.NO)
            {
                ynmDelete=null;
                jfcExport=null;
                return;
            }
        }
        FileOutputStream fosWriter;
        StringBuffer sbString=new StringBuffer();
        try
        {
            fosWriter=new FileOutputStream(fleOutput);
            DefaultTableModel dtmTrans=(DefaultTableModel)mwcMain.getCurrentTransactionTable().getModel();
            for(int i=0; i<dtmTrans.getRowCount(); i++)
            {
                for(int j=0; j<dtmTrans.getColumnCount(); j++)
                {
                    if(j==0)
                        continue;
                    if(j!=1)
                        sbString.append("\"");
                    if(j==2)
                        sbString.append(-Double.parseDouble(dtmTrans.getValueAt(i, j).toString()));
                    else
                        sbString.append(dtmTrans.getValueAt(i, j));
                    if(j!=1)
                        sbString.append("\"");
                    if(j!=dtmTrans.getColumnCount()-1)
                        sbString.append(',');
                }
                sbString.append('\n');
                fosWriter.write(sbString.toString().getBytes());
                sbString.delete(0, sbString.length());
            }
        }
        catch(IOException ex)
        {
            OKMessage okm=new OKMessage(mwcMain, "Unable to write file to disk!");
            okm.setVisible(true);
            okm=null;
        }
        finally
        {
            fosWriter=null;
View Full Code Here

                    }
                    fwDBWriter=new FileWriter(fdCreate.getSelectedFile(), prfMain);
                }
                if(!fwDBWriter.write(pcPass.getPassword()))
                {
                    OKMessage okError=new OKMessage(mwcMain, "The error occured while writing the file!");
                    okError.setVisible(true);
                    okError=null;
                }
                else
                {
                    mwcMain.setPassword(pcPass.getPassword());
View Full Code Here

TOP

Related Classes of Messages.OKMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.