Coverage Report - org.homeunix.thecave.buddi.view.menu.items.ViewDataFileStats
 
Classes in this File Line Coverage Branch Coverage Complexity
ViewDataFileStats
100%
5/5
N/A
1
 
 1  
 /*
 2  
  * Created on Aug 6, 2007 by wyatt
 3  
  */
 4  
 package org.homeunix.thecave.buddi.view.menu.items;
 5  
 
 6  
 import java.awt.event.ActionEvent;
 7  
 
 8  
 import javax.swing.JOptionPane;
 9  
 
 10  
 import org.homeunix.thecave.buddi.i18n.BuddiKeys;
 11  
 import org.homeunix.thecave.buddi.i18n.keys.MenuKeys;
 12  
 import org.homeunix.thecave.buddi.model.Document;
 13  
 import org.homeunix.thecave.buddi.model.prefs.PrefsModel;
 14  
 import org.homeunix.thecave.buddi.plugin.api.util.TextFormatter;
 15  
 import org.homeunix.thecave.buddi.util.Formatter;
 16  
 import org.homeunix.thecave.buddi.view.MainFrame;
 17  
 
 18  
 import ca.digitalcave.moss.swing.MossMenuItem;
 19  
 
 20  
 public class ViewDataFileStats extends MossMenuItem{
 21  
         public static final long serialVersionUID = 0;
 22  
         
 23  
         public ViewDataFileStats(MainFrame frame) {
 24  30480
                 super(frame, PrefsModel.getInstance().getTranslator().get(MenuKeys.MENU_VIEW_DATA_FILE_STATS));
 25  30480
         }
 26  
         
 27  
         @Override
 28  
         public void actionPerformed(ActionEvent e) {
 29  6
                 Document model = (Document) ((MainFrame) getFrame()).getDocument();
 30  6
                 JOptionPane.showMessageDialog(
 31  
                                 getFrame(), 
 32  
                                 "<html><h3>" + 
 33  
                                 TextFormatter.getTranslation(BuddiKeys.DATA_FILE_STATS) +
 34  
                                 "</h3><p>" +
 35  
                                 TextFormatter.getTranslation(BuddiKeys.DATA_FILE_STATS_ACCOUNTS) + " " +
 36  
                                 Formatter.getDecimalFormat(0).format(model.getAccounts().size()) +
 37  
                                 "</p><p>" +
 38  
                                 TextFormatter.getTranslation(BuddiKeys.DATA_FILE_STATS_BUDGET_CATEGORIES) + " " +
 39  
                                 Formatter.getDecimalFormat(0).format(model.getBudgetCategories().size()) +
 40  
                                 "</p><p>" +
 41  
                                 TextFormatter.getTranslation(BuddiKeys.DATA_FILE_STATS_TRANSACTIONS) + " " +
 42  
                                 Formatter.getDecimalFormat(0).format(model.getTransactions().size()) +
 43  
                                 "</p><p>" +
 44  
                                 TextFormatter.getTranslation(BuddiKeys.DATA_FILE_STATS_SCHEDULED_TRANSACTIONS) + " " +
 45  
                                 Formatter.getDecimalFormat(0).format(model.getScheduledTransactions().size()) +
 46  
                                 "</p></html>", 
 47  
                                 TextFormatter.getTranslation(BuddiKeys.DATA_FILE_STATS_TITLE), 
 48  
                                 JOptionPane.INFORMATION_MESSAGE);
 49  5
         }
 50  
 }