1 44 45 package org.jfree.ui.about; 46 47 import java.util.List ; 48 import java.util.ResourceBundle ; 49 50 import javax.swing.table.AbstractTableModel ; 51 52 59 public class ContributorsTableModel extends AbstractTableModel { 60 61 62 private List contributors; 63 64 65 private String nameColumnLabel; 66 67 68 private String contactColumnLabel; 69 70 75 public ContributorsTableModel(final List contributors) { 76 77 this.contributors = contributors; 78 79 final String baseName = "org.jfree.ui.about.resources.AboutResources"; 80 final ResourceBundle resources = ResourceBundle.getBundle(baseName); 81 this.nameColumnLabel = resources.getString("contributors-table.column.name"); 82 this.contactColumnLabel = resources.getString("contributors-table.column.contact"); 83 84 } 85 86 91 public int getRowCount() { 92 return this.contributors.size(); 93 } 94 95 101 public int getColumnCount() { 102 return 2; 103 } 104 105 112 public String getColumnName(final int column) { 113 114 String result = null; 115 116 switch (column) { 117 118 case 0: result = this.nameColumnLabel; 119 break; 120 121 case 1: result = this.contactColumnLabel; 122 break; 123 124 } 125 126 return result; 127 128 } 129 130 138 public Object getValueAt(final int row, final int column) { 139 140 Object result = null; 141 final Contributor contributor = (Contributor) this.contributors.get(row); 142 143 if (column == 0) { 144 result = contributor.getName(); 145 } 146 else if (column == 1) { 147 result = contributor.getEmail(); 148 } 149 return result; 150 151 } 152 153 } 154 | Popular Tags |