+
+ combo.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ final SearchableTag tag = (SearchableTag) combo
+ .getSelectedItem();
+ if (tag != null) {
+ addTagBar(tag, new Runnable() {
+ @Override
+ public void run() {
+ // TODO: stories if needed
+ setWaitingScreen(false);
+ }
+ });
+ }
+ }
+ });
+
+ tagBars.add(combo);
+ }
+
+ // async, add children of tag, NULL = base tags
+ private void addTagBar(final SearchableTag tag, final Runnable inUi) {
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ BasicSearchable searchable = BasicSearchable
+ .getSearchable(supportType);
+
+ List<SearchableTag> children = new ArrayList<SearchableTag>();
+ if (tag == null) {
+ try {
+ List<SearchableTag> baseTags = searchable.getTags();
+ children = baseTags;
+ } catch (IOException e) {
+ error(e);
+ }
+ } else {
+ try {
+ searchable.fillTag(tag);
+ } catch (IOException e) {
+ error(e);
+ }
+
+ if (!tag.isLeaf()) {
+ children = tag.getChildren();
+ } else {
+ children = null;
+ // TODO: stories
+ }
+ }
+
+ final List<SearchableTag> fchildren = children;
+ inUi(new Runnable() {
+ @Override
+ public void run() {
+ if (fchildren != null) {
+ addTagBar(fchildren, tag);
+ }
+
+ if (inUi != null) {
+ inUi.run();
+ }
+ }
+ });
+ }
+ }).start();