From 4c926c076ed42dc2dbd81eabb7cad64a36a67f34 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sun, 26 Apr 2009 18:57:27 +0000 Subject: [PATCH] * EpisodeFormatDialog: initialize selectedOption with Option.CANCEL * RenameListCellRenderer: don't display type label in name list * EpisodeFormatBindingBean: get cache only when needed --- .../format/EpisodeFormatBindingBean.java | 10 +++++----- .../filebot/ui/EpisodeFormatDialog.java | 2 +- .../panel/rename/RenameListCellRenderer.java | 19 ------------------- 3 files changed, 6 insertions(+), 25 deletions(-) diff --git a/source/net/sourceforge/filebot/format/EpisodeFormatBindingBean.java b/source/net/sourceforge/filebot/format/EpisodeFormatBindingBean.java index b19aed99..5d5a65e8 100644 --- a/source/net/sourceforge/filebot/format/EpisodeFormatBindingBean.java +++ b/source/net/sourceforge/filebot/format/EpisodeFormatBindingBean.java @@ -200,12 +200,12 @@ public class EpisodeFormatBindingBean { return null; } - private static final Cache checksumCache = CacheManager.getInstance().getCache("checksum"); - - + private String crc32(File file) throws IOException, InterruptedException { // try to get checksum from cache - Element cacheEntry = checksumCache.get(file); + Cache cache = CacheManager.getInstance().getCache("checksum"); + + Element cacheEntry = cache.get(file); if (cacheEntry != null) { return (String) cacheEntry.getValue(); @@ -232,7 +232,7 @@ public class EpisodeFormatBindingBean { String checksum = String.format("%08X", crc.getValue()); - checksumCache.put(new Element(file, checksum)); + cache.put(new Element(file, checksum)); return checksum; } diff --git a/source/net/sourceforge/filebot/ui/EpisodeFormatDialog.java b/source/net/sourceforge/filebot/ui/EpisodeFormatDialog.java index 01ab84b6..c6757ede 100644 --- a/source/net/sourceforge/filebot/ui/EpisodeFormatDialog.java +++ b/source/net/sourceforge/filebot/ui/EpisodeFormatDialog.java @@ -64,7 +64,7 @@ import net.sourceforge.tuned.ui.notification.SeparatorBorder.Position; public class EpisodeFormatDialog extends JDialog { - private Option selectedOption = null; + private Option selectedOption = Option.CANCEL; private JLabel preview = new JLabel(); diff --git a/source/net/sourceforge/filebot/ui/panel/rename/RenameListCellRenderer.java b/source/net/sourceforge/filebot/ui/panel/rename/RenameListCellRenderer.java index 2556b2e1..08e02948 100644 --- a/source/net/sourceforge/filebot/ui/panel/rename/RenameListCellRenderer.java +++ b/source/net/sourceforge/filebot/ui/panel/rename/RenameListCellRenderer.java @@ -19,9 +19,7 @@ import javax.swing.border.EmptyBorder; import net.miginfocom.swing.MigLayout; import net.sourceforge.filebot.ResourceManager; -import net.sourceforge.filebot.similarity.Match; import net.sourceforge.filebot.ui.panel.rename.RenameModel.FormattedFuture; -import net.sourceforge.filebot.web.Episode; import net.sourceforge.tuned.FileUtilities; import net.sourceforge.tuned.ui.DefaultFancyListCellRenderer; @@ -73,8 +71,6 @@ class RenameListCellRenderer extends DefaultFancyListCellRenderer { setIcon(ResourceManager.getIcon("worker.started")); break; } - - typeLabel.setText(getType(future.getMatch())); } if (!renameModel.hasComplement(index)) { @@ -101,21 +97,6 @@ class RenameListCellRenderer extends DefaultFancyListCellRenderer { return "File"; } - - protected String getType(Match match) { - Object source = match.getValue(); - - if (source instanceof Episode) { - return "Episode"; - } else if (source instanceof AbstractFileEntry) { - return "Torrent"; - } else if (source instanceof File) { - return "File"; - } - - return null; - } - private class TypeLabel extends JLabel {