use of java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock in project jgnash by ccavanaugh.
the class AbstractExpandingTableModel method restoreExpansionState.
private void restoreExpansionState(final String state) {
WriteLock writeLock = rwl.writeLock();
writeLock.lock();
try {
if (state != null && state.length() == objects.size()) {
ArrayList<ExpandingTableNode<E>> values = new ArrayList<>(objects.values());
Collections.sort(values);
for (int i = 0; i < state.length(); i++) {
values.get(i).setExpanded(state.charAt(i) == '1');
}
}
} finally {
writeLock.unlock();
}
}
Aggregations