IngAusOfxFixController.java 文件源码

java
阅读 20 收藏 0 点赞 0 评论 0

项目:IngAusOfxFixLinux 作者:
@FXML
    public void handleBtnActionSaveSettings(Event e) throws IOException {

        int i = 0;
        String suffix;
        String tmpBook;

        defaultProps.setProperty(DEFAULT_PROP, BankAcct.getDefaultBankAcct());

        // Until problem in Java 8u92 with adding items to ComboBox which uses SortedList is fixed,
        //  sort the bankAccts before saving

//      Set bankAcctSet = bankAcctMap.keySet();
//      Iterator itr = bankAcctSet.iterator();

        SortedList sortedBookList = new SortedList<>(bankAcctComboBoxData, Collator.getInstance());
        Iterator itr = sortedBookList.iterator();

        while (itr.hasNext()) {
            tmpBook = (String) itr.next();
            BankAcct refBook = (BankAcct) bankAcctMap.get(tmpBook);
            suffix = String.valueOf(i++);
            defaultProps.setProperty(ACCTNAME_PROP + suffix, refBook.getBankAcctName());
            defaultProps.setProperty(BANKID_PROP + suffix, refBook.getBankAcctBankId());
            defaultProps.setProperty(ACCTNO_PROP + suffix, refBook.getBankAcctNo());
            defaultProps.setProperty(ACCTTYPE_PROP + suffix, refBook.getBankAcctType());
            defaultProps.setProperty(OFXDIR_PROP + suffix, refBook.getBankAcctOfxDir());
        }

        try (FileOutputStream out = new FileOutputStream(DEF_PROP)) {
            defaultProps.store(out, "---Backup GnuCash Settings---");
            taLog.setText("Settings successfully saved to " + DEF_PROP);
        } catch (IOException ex) {
            //System.out.println("My Exception Message " + ex.getMessage());
            //System.out.println("My Exception Class " + ex.getClass());
            Logger.getLogger(IngAusOfxFixController.class.getName()).log(Level.SEVERE, null, ex);
            taLog.setText("Error: Cannot Save Settings to : " + DEF_PROP);
        }
    }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号