1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-26 09:48:56 -05:00

* refactor

This commit is contained in:
Reinhard Pointner 2014-01-12 16:42:22 +00:00
parent 4c4cfa57a2
commit 47982a63f6
4 changed files with 9 additions and 12 deletions

View File

@ -13,6 +13,7 @@ import java.beans.PropertyChangeListener;
import java.net.URI; import java.net.URI;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.TreeSet;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -83,7 +84,9 @@ public abstract class AbstractSearchPanel<S, E> extends JComponent {
@Override @Override
protected Collection<String> doInBackground() throws Exception { protected Collection<String> doInBackground() throws Exception {
return getHistory(engine); TreeSet<String> set = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
set.addAll(getHistory(engine));
return set;
} }
@Override @Override

View File

@ -47,9 +47,10 @@ public class SelectButtonTextField<T> extends JComponent {
add(selectButton, "h pref!, w pref!, sizegroupy this"); add(selectButton, "h pref!, w pref!, sizegroupy this");
add(editor, "gap 0, w 195px!, sizegroupy this"); add(editor, "gap 0, w 195px!, sizegroupy this");
editor.setRenderer(new CompletionCellRenderer());
editor.setPrototypeDisplayValue("X"); editor.setPrototypeDisplayValue("X");
editor.setRenderer(new CompletionCellRenderer());
editor.setUI(new TextFieldComboBoxUI()); editor.setUI(new TextFieldComboBoxUI());
editor.setMaximumRowCount(10);
TunedUtilities.installAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_UP, KeyEvent.CTRL_MASK), new SpinClientAction(-1)); TunedUtilities.installAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_UP, KeyEvent.CTRL_MASK), new SpinClientAction(-1));
TunedUtilities.installAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, KeyEvent.CTRL_MASK), new SpinClientAction(1)); TunedUtilities.installAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, KeyEvent.CTRL_MASK), new SpinClientAction(1));
@ -170,6 +171,7 @@ public class SelectButtonTextField<T> extends JComponent {
}); });
// massive performance boost for list rendering is cell height is fixed
popup.getList().setPrototypeCellValue("X"); popup.getList().setPrototypeCellValue("X");
} }

View File

@ -18,7 +18,6 @@ import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.TreeSet;
import javax.swing.AbstractAction; import javax.swing.AbstractAction;
import javax.swing.Icon; import javax.swing.Icon;
@ -90,10 +89,7 @@ public class EpisodeListPanel extends AbstractSearchPanel<EpisodeListProvider, E
names.add(Normalization.removeTrailingBrackets(n)); names.add(Normalization.removeTrailingBrackets(n));
} }
} }
return names;
TreeSet<String> treeSet = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
treeSet.addAll(names);
return treeSet;
} }
@Override @Override

View File

@ -17,7 +17,6 @@ import java.net.URI;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.TreeSet;
import java.util.logging.Level; import java.util.logging.Level;
import javax.swing.AbstractAction; import javax.swing.AbstractAction;
@ -152,10 +151,7 @@ public class SubtitlePanel extends AbstractSearchPanel<SubtitleProvider, Subtitl
names.add(Normalization.removeTrailingBrackets(n)); names.add(Normalization.removeTrailingBrackets(n));
} }
} }
return names;
TreeSet<String> treeSet = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
treeSet.addAll(names);
return treeSet;
}; };
@Override @Override