@Override public void onElementAdded(Doc.E newElement) { // When a deletion and insertion are composed it's possible that // recalculation from the deletion event changes the current element // to the newly inserted canonical element before this event // is fired. Thus the check that the new element is not already // the current element. // Yet another failure of the ElementListener interface. if (newElement == findCanonicalElement() && newElement != currentElement) { changeCurrentValue(newElement); } }
@Override public void onElementRemoved(Doc.E removedElement) { if (removedElement == currentElement) { changeCurrentValue(findCanonicalElement()); } }