From 47982a63f6ce88bcd64d4e4ae776cba6426c883f Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sun, 12 Jan 2014 16:42:22 +0000 Subject: [PATCH] * refactor --- source/net/sourceforge/filebot/ui/AbstractSearchPanel.java | 5 ++++- .../net/sourceforge/filebot/ui/SelectButtonTextField.java | 4 +++- .../filebot/ui/episodelist/EpisodeListPanel.java | 6 +----- .../net/sourceforge/filebot/ui/subtitle/SubtitlePanel.java | 6 +----- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/source/net/sourceforge/filebot/ui/AbstractSearchPanel.java b/source/net/sourceforge/filebot/ui/AbstractSearchPanel.java index 2e692fa8..34507f66 100644 --- a/source/net/sourceforge/filebot/ui/AbstractSearchPanel.java +++ b/source/net/sourceforge/filebot/ui/AbstractSearchPanel.java @@ -13,6 +13,7 @@ import java.beans.PropertyChangeListener; import java.net.URI; import java.util.Arrays; import java.util.Collection; +import java.util.TreeSet; import java.util.logging.Level; import java.util.logging.Logger; @@ -83,7 +84,9 @@ public abstract class AbstractSearchPanel extends JComponent { @Override protected Collection doInBackground() throws Exception { - return getHistory(engine); + TreeSet set = new TreeSet(String.CASE_INSENSITIVE_ORDER); + set.addAll(getHistory(engine)); + return set; } @Override diff --git a/source/net/sourceforge/filebot/ui/SelectButtonTextField.java b/source/net/sourceforge/filebot/ui/SelectButtonTextField.java index e5501f71..a1ea8829 100644 --- a/source/net/sourceforge/filebot/ui/SelectButtonTextField.java +++ b/source/net/sourceforge/filebot/ui/SelectButtonTextField.java @@ -47,9 +47,10 @@ public class SelectButtonTextField extends JComponent { add(selectButton, "h pref!, w pref!, sizegroupy this"); add(editor, "gap 0, w 195px!, sizegroupy this"); - editor.setRenderer(new CompletionCellRenderer()); editor.setPrototypeDisplayValue("X"); + editor.setRenderer(new CompletionCellRenderer()); 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_DOWN, KeyEvent.CTRL_MASK), new SpinClientAction(1)); @@ -170,6 +171,7 @@ public class SelectButtonTextField extends JComponent { }); + // massive performance boost for list rendering is cell height is fixed popup.getList().setPrototypeCellValue("X"); } diff --git a/source/net/sourceforge/filebot/ui/episodelist/EpisodeListPanel.java b/source/net/sourceforge/filebot/ui/episodelist/EpisodeListPanel.java index 434b9920..5b4e1935 100644 --- a/source/net/sourceforge/filebot/ui/episodelist/EpisodeListPanel.java +++ b/source/net/sourceforge/filebot/ui/episodelist/EpisodeListPanel.java @@ -18,7 +18,6 @@ import java.util.Arrays; import java.util.Collection; import java.util.List; import java.util.Locale; -import java.util.TreeSet; import javax.swing.AbstractAction; import javax.swing.Icon; @@ -90,10 +89,7 @@ public class EpisodeListPanel extends AbstractSearchPanel treeSet = new TreeSet(String.CASE_INSENSITIVE_ORDER); - treeSet.addAll(names); - return treeSet; + return names; } @Override diff --git a/source/net/sourceforge/filebot/ui/subtitle/SubtitlePanel.java b/source/net/sourceforge/filebot/ui/subtitle/SubtitlePanel.java index 2399159e..7abb8794 100644 --- a/source/net/sourceforge/filebot/ui/subtitle/SubtitlePanel.java +++ b/source/net/sourceforge/filebot/ui/subtitle/SubtitlePanel.java @@ -17,7 +17,6 @@ import java.net.URI; import java.util.ArrayList; import java.util.Collection; import java.util.List; -import java.util.TreeSet; import java.util.logging.Level; import javax.swing.AbstractAction; @@ -152,10 +151,7 @@ public class SubtitlePanel extends AbstractSearchPanel treeSet = new TreeSet(String.CASE_INSENSITIVE_ORDER); - treeSet.addAll(names); - return treeSet; + return names; }; @Override