1 package org.columba.mail.gui.config.accountlist; 17 18 import javax.swing.table.AbstractTableModel ; 19 20 import org.columba.mail.config.AccountItem; 21 import org.columba.mail.config.AccountList; 22 import org.columba.mail.util.MailResourceLoader; 23 24 25 class AccountListDataModel extends AbstractTableModel { 26 final String [] columnNames = { 27 MailResourceLoader.getString("dialog", "account", "accountname"), MailResourceLoader.getString("dialog", "account", "type"), }; 30 private AccountList accountList; 31 32 public AccountListDataModel(AccountList list) { 33 super(); 34 this.accountList = list; 35 } 36 37 public int getColumnCount() { 38 return columnNames.length; 39 } 40 41 public int getRowCount() { 42 return accountList.count(); 43 } 44 45 public String getColumnName(int col) { 46 return columnNames[col]; 47 } 48 49 public Object getValueAt(int row, int col) { 50 AccountItem item = accountList.get(row); 51 52 if (item == null) { 53 return ""; 54 } 55 56 if (col == 0) { 57 62 return item; 63 } else { 64 return item.isPopAccount() ? "POP3" : "IMAP4"; 65 } 66 } 67 68 public Class getColumnClass(int c) { 69 if (c == 0) { 70 return AccountItem.class; 71 } else { 72 return String .class; 73 } 74 } 75 76 85 } 86 | Popular Tags |