protected List<BookInfo> doInBackground() throws Exception {
List<BookInfo> bookInfos = new ArrayList<BookInfo>();
BasicLibrary lib = Instance.getInstance().getLibrary();
- for (MetaData meta : lib.getList(null).filter(sources, authors, tags)) {
+ for (MetaData meta : lib.getList().filter(sources, authors, tags)) {
bookInfos.add(BookInfo.fromMeta(lib, meta));
}
@Override
public void invalidateCache() {
+ // TODO: also reset the popup menu for sources/author
fireActionPerformed(INVALIDATE_CACHE);
}
});
/**
* This item library cache state.
*
- * @return TRUE if it is present in the {@link GuiReader} cache
+ * @return TRUE if it is present in the {@link CacheLibrary} cache
*/
public boolean isCached() {
return cached;
/**
* This item library cache state.
*
- * @param cached TRUE if it is present in the {@link GuiReader} cache
+ * @param cached TRUE if it is present in the {@link CacheLibrary} cache
*/
public void setCached(boolean cached) {
this.cached = cached;
int size = 0;
try {
- size = lib.getListBySource(source).size();
+ size = lib.getList().filter(source, null, null).size();
} catch (IOException e) {
}
int size = 0;
try {
- size = lib.getListByAuthor(author).size();
+ size = lib.getList().filter(null, author, null).size();
} catch (IOException e) {
}
int size = 0;
try {
- for (MetaData meta : lib.getList()) {
- if (meta.getTags().contains(tag)) {
- size++;
- }
- }
+ size = lib.getList().filter(null, null, tag).size();
} catch (IOException e) {
}
private Informer informer;
- private Object object;
-
- private Object object2;
-
- private Object object3;
-
public BookPopup(BasicLibrary lib, Informer informer) {
this.lib = lib;
this.informer = informer;
// enough, we need to clear the whole cache (for BrowserPanel for instance)
informer.invalidateCache();
- // TODO: not enough!!
- // after move, item disappears in the list, probably caused by the Library
- // itself
+ // TODO: also refresh the Sources/Authors(/Tags?) list
// Even if problems occurred, still invalidate the cache
get();
luids.add(book.getMeta().getLuid());
break;
case SOURCE:
- for (MetaData meta : lib.getListBySource(book.getMainInfo())) {
+ for (MetaData meta : lib.getList().filter(book.getMainInfo(), null, null)) {
luids.add(meta.getLuid());
}
break;
case AUTHOR:
- for (MetaData meta : lib.getListByAuthor(book.getMainInfo())) {
+ for (MetaData meta : lib.getList().filter(null, book.getMainInfo(), null)) {
luids.add(meta.getLuid());
}
break;
case TAG:
- for (MetaData meta : lib.getList(null).filter(null, null, book.getMainInfo())) {
+ for (MetaData meta : lib.getList().filter(null, null, book.getMainInfo())) {
luids.add(meta.getLuid());
}
break;