1 package SnowMailClient.SpamFilter; 2 3 import snow.sortabletable.*; 4 import snow.utils.gui.*; 5 import javax.swing.*; 6 import javax.swing.event.*; 7 import java.awt.*; 8 import java.awt.event.*; 9 import SnowMailClient.Language.*; 10 import SnowMailClient.*; 11 import java.util.*; 12 13 public final class StatViewer extends JDialog 14 { 15 final private JTable table = new JTable(); 16 final private SortableTableModel sortableTableModel; 17 final private Map<String ,Word> wordsTable = SnowMailClientApp.getInstance().getWordStatistic().getAllWords(); 18 19 public final static String TITLE = Language.translate("SPAM Statistics"); 20 21 public StatViewer(JFrame parent) 22 { 23 super(parent, TITLE, true); 24 getContentPane().setLayout(new BorderLayout()); 25 26 28 sortableTableModel = new SortableTableModel(new SpamStatTableModel(wordsTable)); 29 table.setModel(sortableTableModel); 30 sortableTableModel.installGUI(table); 31 this.getContentPane().add(new JScrollPane(table), BorderLayout.CENTER); 32 33 AdvancedSearchPanel searchPanel = new AdvancedSearchPanel(Language.translate("Search")+": ", null, sortableTableModel, true); 35 this.getContentPane().add(searchPanel, BorderLayout.NORTH); 36 37 CloseControlPanel ccp = new CloseControlPanel(this, false, true, Language.translate("Close")); 39 this.getContentPane().add(ccp, BorderLayout.SOUTH); 40 41 updateTitleLabel(); 42 43 SnowMailClientApp.getInstance().getProperties().setComponentSizeFromINIFile( 44 this, "SpamStatViewer", 340,600, 200,100); 45 setVisible(true); 46 SnowMailClientApp.getInstance().getProperties().saveComponentSizeInINIFile(this, "SpamStatViewer"); 47 } 49 50 private void updateTitleLabel() 51 { 52 String hitString = (sortableTableModel.getRowCount()<wordsTable.size() ? 53 " ("+sortableTableModel.getRowCount()+" "+Language.translate("hits")+")" 54 :""); 55 setTitle(TITLE+" ["+wordsTable.size()+" "+Language.translate("words")+"]"+hitString); 56 } 57 58 59 } | Popular Tags |