* EpisodeFormatDialog: initialize selectedOption with Option.CANCEL

* RenameListCellRenderer: don't display type label in name list
* EpisodeFormatBindingBean: get cache only when needed
This commit is contained in:
Reinhard Pointner 2009-04-26 18:57:27 +00:00
parent d5a5b93b3b
commit 4c926c076e
3 changed files with 6 additions and 25 deletions

View File

@ -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;
}

View File

@ -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();

View File

@ -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)) {
@ -102,21 +98,6 @@ class RenameListCellRenderer extends DefaultFancyListCellRenderer {
}
protected String getType(Match<Object, File> 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 {
private final Insets margin = new Insets(0, 10, 0, 0);