mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-05 10:49:24 +02:00
AuthorListTree
This commit is contained in:
parent
5f9822ba5f
commit
e4912a2beb
4 changed files with 117 additions and 1 deletions
|
@ -142,6 +142,30 @@ public abstract class LibraryTree extends FBTree {
|
|||
return !toRemove.isEmpty();
|
||||
}
|
||||
|
||||
public boolean onBookEvent(BookEvent event, Book book) {
|
||||
switch (event) {
|
||||
default:
|
||||
case Added:
|
||||
return false;
|
||||
case Removed:
|
||||
return removeBook(book, true);
|
||||
case Updated:
|
||||
{
|
||||
boolean changed = false;
|
||||
for (FBTree tree : this) {
|
||||
if (tree instanceof BookTree) {
|
||||
final Book b = ((BookTree)tree).Book;
|
||||
if (b.equals(book)) {
|
||||
b.updateFrom(book);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(FBTree tree) {
|
||||
final int cmp = super.compareTo(tree);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue