/** {@inheritDoc} */ @Override public E set(int index, E value) { if(index < 0 || index >= size()) throw new IndexOutOfBoundsException("Cannot set at " + index + " on list of size " + size()); updates.beginEvent(true); // remove all duplicates of this value first int startIndex = getSourceIndex(index) + 1; int endIndex = getEndIndex(index); if(endIndex > startIndex) { ((SortedList)source).subList(startIndex, endIndex).clear(); } // now do the set E result = super.set(index, value); updates.commitEvent(); return result; }
/** {@inheritDoc} */ @Override public E set(int index, E value) { if(index < 0 || index >= size()) throw new IndexOutOfBoundsException("Cannot set at " + index + " on list of size " + size()); updates.beginEvent(true); // remove all duplicates of this value first int startIndex = getSourceIndex(index) + 1; int endIndex = getEndIndex(index); if(endIndex > startIndex) { ((SortedList)source).subList(startIndex, endIndex).clear(); } // now do the set E result = super.set(index, value); updates.commitEvent(); return result; }
/** {@inheritDoc} */ @Override public E set(int index, E value) { if(index < 0 || index >= size()) throw new IndexOutOfBoundsException("Cannot set at " + index + " on list of size " + size()); updates.beginEvent(true); // remove all duplicates of this value first int startIndex = getSourceIndex(index) + 1; int endIndex = getEndIndex(index); if(endIndex > startIndex) { ((SortedList)source).subList(startIndex, endIndex).clear(); } // now do the set E result = super.set(index, value); updates.commitEvent(); return result; }
/** {@inheritDoc} */ public void setContentAt(int column, int row, Object value) { // header rows aren't editable if(row < getFixedHeaderRowCount()) { throw new UnsupportedOperationException("Unexpected set() on column header"); // regular rows are editable if the tableformat is writable } else if(kTableFormat instanceof WritableTableFormat) { swtThreadSource.getReadWriteLock().readLock().lock(); try { WritableTableFormat writableTableFormat = (WritableTableFormat)kTableFormat; Object baseObject = swtThreadSource.get(row - getFixedHeaderRowCount()); Object updatedObject = writableTableFormat.setColumnValue(baseObject, value, column); if(updatedObject != null) { swtThreadSource.set(row - getFixedHeaderRowCount(), updatedObject); } } finally { swtThreadSource.getReadWriteLock().readLock().unlock(); } // this table isn't editable } else { throw new UnsupportedOperationException("Unexpected set() on read-only table"); } }