/** * Convert row index from view coordinates to model coordinates * accounting for the presence of sorters and filters. * * PRE: 0 <= row < getSize() * * @param row the row index in this filter's output ("view") coordinates * @return row index in absolute model coordinates */ public int convertRowIndexToModel(int row) { int mappedRow = mapTowardModel(row); Filter filter = getMappingFilter(); if (filter != null) { mappedRow = filter.convertRowIndexToModel(mappedRow); } return mappedRow; }
/** * Returns editability of the cell identified by the specified row * and column index. The column index is in absolute column coordinates. * * PRE: 0 <= row < <code>getSize()</code> * * @param row the row index in this filter's output ("view") coordinates * @param column column index in model coordinates * @return true if the cell at the specified row/col is editable */ public boolean isCellEditable(int row, int column) { int mappedRow = mapTowardModel(row); Filter filter = getMappingFilter(); if (filter != null) { return filter.isCellEditable(mappedRow, column); } return adapter.isCellEditable(mappedRow, column); }
/** * Returns the value at the specified row and column. * The column index is in absolute column coordinates. * * PRE: 0 <= row < getSize() * * @param row the row index in this filter's output ("view") coordinates * @param column column index in absolute model coordinates * @return the value at the specified row and column */ public Object getValueAt(int row, int column) { int mappedRow = mapTowardModel(row); Filter filter = getMappingFilter(); if (filter != null) { return filter.getValueAt(mappedRow, column); } return adapter.getValueAt(mappedRow, column); }
/** * Returns the string representation at the specified row and column. * The column index is in absolute column coordinates. * * PRE: 0 <= row < getSize() * * @param row the row index in this filter's output ("view") coordinates * @param column column index in model coordinates * @return the string representation of the cell at the specified row and column. */ public String getStringAt(int row, int column) { int mappedRow = mapTowardModel(row); Filter filter = getMappingFilter(); if (filter != null) { return filter.getStringAt(mappedRow, column); } return adapter.getStringAt(mappedRow, column); } /**
/** * Sets the specified value as the new value for the cell identified by the * specified row and column index. The column index is in absolute column coordinates. * * PRE: 0 <= row < getSize() * * @param aValue new value for the specified cell * @param row the row index in this filter's output ("view") coordinates * @param column the column index in absolute model coordinates */ public void setValueAt(Object aValue, int row, int column) { int mappedRow = mapTowardModel(row); Filter filter = getMappingFilter(); if (filter != null) { filter.setValueAt(aValue, mappedRow, column); return; // make sure you return from here! } adapter.setValueAt(aValue, mappedRow, column); }