*
* @author niki
*/
+// JCombobox<E> not 1.6 compatible
+@SuppressWarnings({ "unchecked", "rawtypes" })
public class GuiReaderSearch extends JFrame {
private static final long serialVersionUID = 1L;
private List<SupportType> supportTypes;
private SupportType supportType;
private boolean searchByTags;
- private List<SearchableTag> tags;
private String keywords;
private int page;
private int maxPage;
setLayout(new BorderLayout());
setSize(800, 600);
- tags = new ArrayList<SearchableTag>();
page = 1; // TODO
maxPage = -1;
searchByTags = false;
});
}
- // not 1.6 compatible
- @SuppressWarnings({ "unchecked", "rawtypes" })
private void addTagBar(List<SearchableTag> tags,
final SearchableTag selected) {
tags.add(0, null);
addTagBar(tag, new Runnable() {
@Override
public void run() {
- // TODO: stories if needed
+ // TODO: slow ui
+ SearchableTag tag = ((SearchableTag) combo
+ .getSelectedItem());
+ if (tag != null && tag.isLeaf()) {
+ BasicSearchable searchable = BasicSearchable
+ .getSearchable(supportType);
+ List<MetaData> metas = new ArrayList<MetaData>();
+ try {
+ metas = searchable.search(tag, 1);
+ search(metas, 1,
+ searchable.searchPages(tag), 0);
+ } catch (IOException e) {
+ error(e);
+ }
+ }
+
setWaitingScreen(false);
}
});
}
});
+ combos.add(combo);
tagBars.add(combo);
}
children = tag.getChildren();
} else {
children = null;
- // TODO: stories
}
}
}).start();
}
- // tag: must be filled (or NULL for base tags)
+ // tag: null = base tags
public void searchTag(final SupportType searchOn, final int page,
final int item, final SearchableTag tag) {
.getSearchable(searchOn);
if (tag != null) {
+ try {
+ search.fillTag(tag);
+ } catch (IOException e) {
+ error(e);
+ }
+
int maxPage = 0;
try {
maxPage = search.searchPages(tag);