1 package yukihane.inqubuss.model;
3 import java.util.ArrayList;
4 import java.util.Collection;
6 import javax.swing.table.AbstractTableModel;
12 public class TargetsTableModel extends AbstractTableModel {
14 private final List<Target> targets = new ArrayList<Target>();
15 private final String[] columnNames = new String[]{"動画", "コメント", "投コメ", "状態"};
16 private final Class<?>[] columnClasses = new Class<?>[]{Location.class, Location.class, Location.class, Status.class};
19 public int getRowCount() {
20 return targets.size();
24 public int getColumnCount() {
25 return columnNames.length;
29 public String getColumnName(int columnIndex) {
30 return columnNames[columnIndex];
34 public Class<?> getColumnClass(int columnIndex) {
35 return columnClasses[columnIndex];
39 public Object getValueAt(int rowIndex, int columnIndex) {
40 Target t = targets.get(rowIndex);
42 switch (columnIndex) {
50 res = t.getOwnerComment();
56 throw new IllegalArgumentException();
62 public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
63 throw new UnsupportedOperationException("Not supported yet.");
66 public void addTarget(Collection<Target> t) {
67 int before = targets.size();
69 int after = targets.size();
71 fireTableRowsInserted(before, after - 1);