Changeset 1169 in josm for trunk/src/org/openstreetmap/josm/corrector/CorrectionTableModel.java
- Timestamp:
- 2008-12-23T15:07:05+01:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/corrector/CorrectionTableModel.java
r1001 r1169 12 12 AbstractTableModel { 13 13 14 15 16 14 private List<C> corrections; 15 private boolean[] apply; 16 private int applyColumn; 17 17 18 public CorrectionTableModel(List<C> corrections) { 19 super(); 20 this.corrections = corrections; 21 apply = new boolean[this.corrections.size()]; 22 Arrays.fill(apply, true); 23 applyColumn = getColumnCount() - 1; 24 } 25 26 abstract public int getColumnCount(); 27 28 abstract protected boolean isBoldCell(int row, int column); 29 abstract public String getCorrectionColumnName(int colIndex); 30 abstract public Object getCorrectionValueAt(int rowIndex, int colIndex); 31 32 public List<C> getCorrections() { 33 return corrections; 34 } 35 36 public int getApplyColumn() { 37 return applyColumn; 38 } 39 40 public boolean getApply(int i) { 41 return apply[i]; 18 public CorrectionTableModel(List<C> corrections) { 19 super(); 20 this.corrections = corrections; 21 apply = new boolean[this.corrections.size()]; 22 Arrays.fill(apply, true); 23 applyColumn = getColumnCount() - 1; 42 24 } 43 25 44 public int getRowCount() { 45 return corrections.size(); 26 abstract public int getColumnCount(); 27 28 abstract protected boolean isBoldCell(int row, int column); 29 abstract public String getCorrectionColumnName(int colIndex); 30 abstract public Object getCorrectionValueAt(int rowIndex, int colIndex); 31 32 public List<C> getCorrections() { 33 return corrections; 46 34 } 47 35 48 @Override 49 public Class<?> getColumnClass(int columnIndex) { 50 if (columnIndex == applyColumn) 51 return Boolean.class; 52 return String.class; 36 public int getApplyColumn() { 37 return applyColumn; 53 38 } 54 39 55 @Override 56 public String getColumnName(int columnIndex) { 57 if (columnIndex == applyColumn) 58 return tr("Apply?"); 59 60 return getCorrectionColumnName(columnIndex); 61 } 62 63 @Override 64 public boolean isCellEditable(int rowIndex, int columnIndex) { 65 return columnIndex == applyColumn; 40 public boolean getApply(int i) { 41 return apply[i]; 66 42 } 67 43 68 @Override 44 public int getRowCount() { 45 return corrections.size(); 46 } 47 48 @Override 49 public Class<?> getColumnClass(int columnIndex) { 50 if (columnIndex == applyColumn) 51 return Boolean.class; 52 return String.class; 53 } 54 55 @Override 56 public String getColumnName(int columnIndex) { 57 if (columnIndex == applyColumn) 58 return tr("Apply?"); 59 60 return getCorrectionColumnName(columnIndex); 61 } 62 63 @Override 64 public boolean isCellEditable(int rowIndex, int columnIndex) { 65 return columnIndex == applyColumn; 66 } 67 68 @Override 69 69 public void setValueAt(Object aValue, int rowIndex, int columnIndex) { 70 71 70 if (columnIndex == applyColumn && aValue instanceof Boolean) 71 apply[rowIndex] = (Boolean)aValue; 72 72 } 73 73 74 74 public Object getValueAt(int rowIndex, int colIndex) { 75 76 77 78 79 75 if (colIndex == applyColumn) 76 return apply[rowIndex]; 77 78 return getCorrectionValueAt(rowIndex, colIndex); 79 } 80 80 }
Note:
See TracChangeset
for help on using the changeset viewer.