Skip to content

Commit

Permalink
loading an aligmment w/ base alignment always emits an event
Browse files Browse the repository at this point in the history
fixes #140
  • Loading branch information
stempler committed Aug 24, 2016
1 parent cea6223 commit 849a9d7
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ public void addOrUpdateAlignment(MutableAlignment alignment) {
// _log.warn("Adding alignments currently does not support merging of base alignments. Import base alignments independently.");
// }

boolean addedBaseCells = false;

// add cells
synchronized (this) {

Expand All @@ -219,9 +221,13 @@ public void addOrUpdateAlignment(MutableAlignment alignment) {
this.alignment.addCell((MutableCell) cell);
added.add(cell);
}
else if (!(cell instanceof BaseAlignmentCell))
else if (!(cell instanceof BaseAlignmentCell)) {
throw new IllegalStateException(
"The given alignment contained a cell which is neither mutable nor from a base alignment.");
}
else {
addedBaseCells = true;
}
}
}

Expand Down Expand Up @@ -255,7 +261,7 @@ else if (!(cell instanceof BaseAlignmentCell))
}
}

if (!added.isEmpty() && addedFunctions) {
if (addedBaseCells || (!added.isEmpty() && addedFunctions)) {
// only emit one combined event (not to trigger multiple
// transformations)
notifyAlignmentChanged();
Expand Down

0 comments on commit 849a9d7

Please sign in to comment.