private List<TSizeConstraint> sizeConstraints = new ArrayList<TSizeConstraint>();
- // TODO: because no way to find out the current index!!
+ // The 2 comboboxes used to select by source/author
private TComboBox selectTargetBox;
private TComboBox selectBox;
addList();
addSearch();
- addSelect(); // last so we can see the drop down over the list
+ addSelect();
TStatusBar statusBar = reader.setStatusBar(this, "Library");
statusBar.addShortcutKeypress(TKeypress.kbCtrlF, CMD_SEARCH, "Search");
@Override
public void DO() {
String smode = selectBox.getText();
- Mode mode;
boolean showTarget;
if (smode == null || smode.equals("(show all)")) {
- mode = null;
showTarget = false;
} else if (smode.equals("Sources")) {
- mode = Mode.SOURCE;
selectTargets.clear();
selectTargets.add("(show all)");
for (String source : reader.getLibrary().getSources()) {
}
showTarget = true;
} else {
- mode = Mode.AUTHOR;
selectTargets.clear();
selectTargets.add("(show all)");
for (String author : reader.getLibrary().getAuthors()) {
}
selectTargetBox.setText(selectTargets.get(0));
- setMode(mode, null);
+ if (showTarget) {
+ TuiReaderMainWindow.this.activate(selectTargetBox);
+ } else {
+ TuiReaderMainWindow.this.activate(list);
+ }
}
};
new TAction() {
@Override
public void DO() {
- // TODO: detect (show all)
- if (selectTargetBox.getText().equals("(show all)")) {
+ if (selectTargetBox.getText().equals(
+ selectTargets.get(0))) {
setMode(mode, null);
} else {
setMode(mode, selectTargetBox.getText());
}
list.setList(listItems);
+ if (listItems.size() > 0) {
+ list.setSelectedIndex(0);
+ }
}
public MetaData getSelectedMeta() {