/** * Must be called after construction. This is a two-phase initialization so * that ListEditor can assign its list field before any sub-editors might call * {@link ListEditor#getList()} */ void attach() { editors.addAll(editorSource.create(workingCopy.size(), 0)); for (int i = 0, j = workingCopy.size(); i < j; i++) { chain.attach(workingCopy.get(i), editors.get(i)); } }
@Override public T remove(int index) { T toReturn = workingCopy.remove(index); E subEditor = editors.remove(index); editorSource.dispose(subEditor); for (int i = index, j = editors.size(); i < j; i++) { editorSource.setIndex(editors.get(i), i); } chain.detach(subEditor); return toReturn; }
void flush() { for (int i = 0, j = workingCopy.size(); i < j; i++) { E subEditor = editors.get(i); T value = chain.getValue(subEditor); // Use of object-identity intentional if (workingCopy.get(i) != value) { workingCopy.set(i, value); } } backing.clear(); backing.addAll(workingCopy); }
public void flush() { currentValue = chain.getValue(subEditor); }
void flush() { final int size = workingCopy.size(); for (int i = 0; i < size; i++) { final E subEditor = editors.get(i); final T value = chain.getValue(subEditor); // Use of object-identity intentional if (workingCopy.get(i) != value) { workingCopy.set(i, value); } } backing.clear(); backing.addAll(workingCopy); }
/** * Must be called after construction. This is a two-phase initialization so that ListEditor can * assign its list field before any sub-editors might call {@link ListEditor#getList()} */ void attach() { editors.addAll(editorSource.create(workingCopy.size(), 0)); final int size = workingCopy.size(); for (int i = 0; i < size; i++) { chain.attach(workingCopy.get(i), editors.get(i)); } }
/** * Must be called after construction. This is a two-phase initialization so * that ListEditor can assign its list field before any sub-editors might call * {@link ListEditor#getList()} */ void attach() { editors.addAll(editorSource.create(workingCopy.size(), 0)); for (int i = 0, j = workingCopy.size(); i < j; i++) { chain.attach(workingCopy.get(i), editors.get(i)); } }
@Override public T remove(int index) { T toReturn = workingCopy.remove(index); E subEditor = editors.remove(index); editorSource.dispose(subEditor); for (int i = index, j = editors.size(); i < j; i++) { editorSource.setIndex(editors.get(i), i); } chain.detach(subEditor); return toReturn; }
/** * Must be called after construction. This is a two-phase initialization so * that ListEditor can assign its list field before any sub-editors might call * {@link ListEditor#getList()} */ void attach() { editors.addAll(editorSource.create(workingCopy.size(), 0)); for (int i = 0, j = workingCopy.size(); i < j; i++) { chain.attach(workingCopy.get(i), editors.get(i)); } }
@Override public T set(int index, T element) { T toReturn = workingCopy.set(index, element); chain.attach(element, editors.get(index)); return toReturn; }
@Override public T remove(int index) { T toReturn = workingCopy.remove(index); E subEditor = editors.remove(index); editorSource.dispose(subEditor); for (int i = index, j = editors.size(); i < j; i++) { editorSource.setIndex(editors.get(i), i); } chain.detach(subEditor); return toReturn; }
public void flush() { currentValue = chain.getValue(subEditor); }
@Override public T set(final int index, final T element) { final T toReturn = workingCopy.set(index, element); chain.attach(element, editors.get(index)); return toReturn; }
@Override public T remove(final int index) { final T toReturn = workingCopy.remove(index); final E subEditor = editors.remove(index); editorSource.dispose(subEditor); final int size = editors.size(); for (int i = index; i < size; i++) { editorSource.setIndex(editors.get(i), i); } chain.detach(subEditor); return toReturn; }
void flush() { for (int i = 0, j = workingCopy.size(); i < j; i++) { E subEditor = editors.get(i); T value = chain.getValue(subEditor); // Use of object-identity intentional if (workingCopy.get(i) != value) { workingCopy.set(i, value); } } backing.clear(); backing.addAll(workingCopy); }
void detach() { final int size = editors.size(); for (int i = 0; i < size; i++) { chain.detach(editors.get(i)); editorSource.dispose(editors.get(i)); } }
@Override public void add(final int index, final T element) { workingCopy.add(index, element); final E subEditor = editorSource.create(index); editors.add(index, subEditor); final int size = editors.size(); for (int i = index + 1; i < size; i++) { editorSource.setIndex(editors.get(i), i); } chain.attach(element, subEditor); }
void detach() { for (int i = 0, j = editors.size(); i < j; i++) { chain.detach(editors.get(i)); editorSource.dispose(editors.get(i)); } }