git://git.nikiroo.be
/
fanfix.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
77e5ecd
)
use filter() instead of list()
author
Niki Roo
<niki@nikiroo.be>
Wed, 8 Apr 2020 15:47:48 +0000
(17:47 +0200)
committer
Niki Roo
<niki@nikiroo.be>
Wed, 8 Apr 2020 15:47:48 +0000
(17:47 +0200)
src/be/nikiroo/fanfix_swing/gui/BooksPanel.java
patch
|
blob
|
blame
|
history
src/be/nikiroo/fanfix_swing/gui/book/BookInfo.java
patch
|
blob
|
blame
|
history
src/be/nikiroo/fanfix_swing/gui/book/BookPopup.java
patch
|
blob
|
blame
|
history
diff --git
a/src/be/nikiroo/fanfix_swing/gui/BooksPanel.java
b/src/be/nikiroo/fanfix_swing/gui/BooksPanel.java
index 73de77e974d7e6e313489ffb3b17ba969c1540b5..8a882136e3803e856ea0bd9cc36f862dc9118a04 100644
(file)
--- a/
src/be/nikiroo/fanfix_swing/gui/BooksPanel.java
+++ b/
src/be/nikiroo/fanfix_swing/gui/BooksPanel.java
@@
-129,7
+129,7
@@
public class BooksPanel extends ListenerPanel {
protected List<BookInfo> doInBackground() throws Exception {
List<BookInfo> bookInfos = new ArrayList<BookInfo>();
BasicLibrary lib = Instance.getInstance().getLibrary();
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));
}
bookInfos.add(BookInfo.fromMeta(lib, meta));
}
@@
-232,6
+232,7
@@
public class BooksPanel extends ListenerPanel {
@Override
public void invalidateCache() {
@Override
public void invalidateCache() {
+ // TODO: also reset the popup menu for sources/author
fireActionPerformed(INVALIDATE_CACHE);
}
});
fireActionPerformed(INVALIDATE_CACHE);
}
});
diff --git
a/src/be/nikiroo/fanfix_swing/gui/book/BookInfo.java
b/src/be/nikiroo/fanfix_swing/gui/book/BookInfo.java
index b7dc509f0c423791dd2693774a61aff9021d675a..de57e848fce3569004134880aa4ad2ba5f5d265f 100644
(file)
--- a/
src/be/nikiroo/fanfix_swing/gui/book/BookInfo.java
+++ b/
src/be/nikiroo/fanfix_swing/gui/book/BookInfo.java
@@
-122,7
+122,7
@@
public class BookInfo {
/**
* This item library cache state.
*
/**
* 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;
*/
public boolean isCached() {
return cached;
@@
-131,7
+131,7
@@
public class BookInfo {
/**
* This item library cache state.
*
/**
* 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;
*/
public void setCached(boolean cached) {
this.cached = cached;
@@
-238,7
+238,7
@@
public class BookInfo {
int size = 0;
try {
int size = 0;
try {
- size = lib.getList
BySource(source
).size();
+ size = lib.getList
().filter(source, null, null
).size();
} catch (IOException e) {
}
} catch (IOException e) {
}
@@
-265,7
+265,7
@@
public class BookInfo {
int size = 0;
try {
int size = 0;
try {
- size = lib.getList
ByAuthor(author
).size();
+ size = lib.getList
().filter(null, author, null
).size();
} catch (IOException e) {
}
} catch (IOException e) {
}
@@
-292,11
+292,7
@@
public class BookInfo {
int size = 0;
try {
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) {
}
} catch (IOException e) {
}
diff --git
a/src/be/nikiroo/fanfix_swing/gui/book/BookPopup.java
b/src/be/nikiroo/fanfix_swing/gui/book/BookPopup.java
index 42f7e3b7205ef1f6cc43af65eb96d5775cd2bef1..c99e2730c45917359cd8e01043772414d6a08035 100644
(file)
--- a/
src/be/nikiroo/fanfix_swing/gui/book/BookPopup.java
+++ b/
src/be/nikiroo/fanfix_swing/gui/book/BookPopup.java
@@
-69,12
+69,6
@@
public class BookPopup extends JPopupMenu {
private Informer informer;
private Informer informer;
- private Object object;
-
- private Object object2;
-
- private Object object3;
-
public BookPopup(BasicLibrary lib, Informer informer) {
this.lib = lib;
this.informer = informer;
public BookPopup(BasicLibrary lib, Informer informer) {
this.lib = lib;
this.informer = informer;
@@
-450,9
+444,7
@@
public class BookPopup extends JPopupMenu {
// enough, we need to clear the whole cache (for BrowserPanel for instance)
informer.invalidateCache();
// 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();
// Even if problems occurred, still invalidate the cache
get();
@@
-517,17
+509,17
@@
public class BookPopup extends JPopupMenu {
luids.add(book.getMeta().getLuid());
break;
case SOURCE:
luids.add(book.getMeta().getLuid());
break;
case SOURCE:
- for (MetaData meta : lib.getList
BySource(book.getMainInfo()
)) {
+ for (MetaData meta : lib.getList
().filter(book.getMainInfo(), null, null
)) {
luids.add(meta.getLuid());
}
break;
case AUTHOR:
luids.add(meta.getLuid());
}
break;
case AUTHOR:
- for (MetaData meta : lib.getList
ByAuthor(book.getMainInfo()
)) {
+ for (MetaData meta : lib.getList
().filter(null, book.getMainInfo(), null
)) {
luids.add(meta.getLuid());
}
break;
case TAG:
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;
luids.add(meta.getLuid());
}
break;