+ // TODO clear not working!!
+
+ String smode = option.getText();
+ Mode mode;
+ if (smode == null || smode.equals("(show all)")) {
+ mode = null;
+ select.setVisible(false);
+ select.setEnabled(false);
+ } else if (smode.equals("Sources")) {
+ mode = Mode.SOURCE;
+ select.setVisible(true);
+ select.setEnabled(true);
+ selects.clear();
+ selects.add("(show all)");
+ for (String source : reader.getLibrary()
+ .getSources()) {
+ selects.add(source);
+ }
+ } else {
+ mode = Mode.AUTHOR;
+ select.setVisible(true);
+ select.setEnabled(true);
+ selects.clear();
+ selects.add("(show all)");
+ for (String author : reader.getLibrary()
+ .getAuthors()) {
+ selects.add(author);
+ }
+ }
+
+ // TODO: detect (show all)
+ if (select.getText().equals("(show all)")) {
+ setMode(mode, null);
+ } else {
+ setMode(mode, select.getText());