* Format Source

This commit is contained in:
Reinhard Pointner 2015-07-25 22:47:19 +00:00
parent 38a046bf2d
commit 8299e849aa
194 changed files with 2700 additions and 2622 deletions

View File

@ -35,6 +35,7 @@ public class ApacheVFS implements ArchiveExtractor, Closeable {
this.archive = fsm.createFileSystem(fsm.toFileObject(file));
}
@Override
public List<FileInfo> listFiles() throws Exception {
List<FileInfo> paths = new ArrayList<FileInfo>();
for (FileObject it : archive.findFiles(ALL_FILES)) {
@ -46,10 +47,12 @@ public class ApacheVFS implements ArchiveExtractor, Closeable {
return paths;
}
@Override
public void extract(File outputDir) throws Exception {
extract(outputDir, null);
}
@Override
public void extract(File outputDir, FileFilter filter) throws Exception {
fsm.toFileObject(outputDir).copyFrom(archive, filter == null ? ALL_FILES : new FileFilterSelector(filter));
}

View File

@ -36,10 +36,11 @@ class ArchiveOpenVolumeCallback implements IArchiveOpenVolumeCallback, IArchiveO
*
* @see IArchiveOpenVolumeCallback#getProperty(PropID)
*/
@Override
public Object getProperty(PropID propID) throws SevenZipException {
switch (propID) {
case NAME:
return name;
case NAME:
return name;
}
return null;
}
@ -56,6 +57,7 @@ class ArchiveOpenVolumeCallback implements IArchiveOpenVolumeCallback, IArchiveO
* <li>test.part001.rar - first part of a multi-part archive. "00" indicates, that at least 100 volumes must exist.</li>
* </ul>
*/
@Override
public IInStream getStream(String filename) throws SevenZipException {
try {
// We use caching of opened streams, so check cache first
@ -98,6 +100,7 @@ class ArchiveOpenVolumeCallback implements IArchiveOpenVolumeCallback, IArchiveO
/**
* Close all opened streams
*/
@Override
public void close() throws IOException {
for (RandomAccessFile file : openedRandomAccessFileList.values()) {
file.close();

View File

@ -29,6 +29,7 @@ class ExtractCallback implements IArchiveExtractCallback {
}
@Override
public ISequentialOutStream getStream(int index, ExtractAskMode extractAskMode) throws SevenZipException {
if (extractAskMode != ExtractAskMode.EXTRACT) {
return null;
@ -54,10 +55,12 @@ class ExtractCallback implements IArchiveExtractCallback {
}
@Override
public void prepareOperation(ExtractAskMode extractAskMode) throws SevenZipException {
}
@Override
public void setOperationResult(ExtractOperationResult extractOperationResult) throws SevenZipException {
if (output != null) {
try {
@ -75,10 +78,12 @@ class ExtractCallback implements IArchiveExtractCallback {
}
@Override
public void setCompleted(long completeValue) throws SevenZipException {
}
@Override
public void setTotal(long total) throws SevenZipException {
}

View File

@ -61,6 +61,7 @@ public class SevenZipExecutable implements ArchiveExtractor {
}
}
@Override
public List<FileInfo> listFiles() throws IOException {
List<FileInfo> paths = new ArrayList<FileInfo>();
@ -81,11 +82,13 @@ public class SevenZipExecutable implements ArchiveExtractor {
return paths;
}
@Override
public void extract(File outputDir) throws IOException {
// e.g. 7z x -y -aos archive.7z
execute(get7zCommand(), "x", "-y", "-aos", archive.getPath(), "-o" + outputDir.getCanonicalPath());
}
@Override
public void extract(File outputDir, FileFilter filter) throws IOException {
// e.g. 7z x -y -aos archive.7z file.txt image.png info.nfo
Stream<String> command = Stream.of(get7zCommand(), "x", "-y", "-aos", archive.getPath(), "-o" + outputDir.getCanonicalPath());

View File

@ -60,6 +60,7 @@ public class SevenZipNativeBindings implements ArchiveExtractor, Closeable {
return item;
}
@Override
public List<FileInfo> listFiles() throws SevenZipException {
List<FileInfo> paths = new ArrayList<FileInfo>();

View File

@ -124,24 +124,24 @@ public class VolumedArchiveInStream implements IInStream {
long newOffset;
boolean proceedWithSeek = false;
switch (seekOrigin) {
case SEEK_SET:
newOffset = offset;
break;
case SEEK_SET:
newOffset = offset;
break;
case SEEK_CUR:
newOffset = absoluteOffset + offset;
break;
case SEEK_CUR:
newOffset = absoluteOffset + offset;
break;
case SEEK_END:
if (absoluteLength == -1) {
openVolume(Integer.MAX_VALUE, false);
proceedWithSeek = true;
}
newOffset = absoluteLength + offset;
break;
case SEEK_END:
if (absoluteLength == -1) {
openVolume(Integer.MAX_VALUE, false);
proceedWithSeek = true;
}
newOffset = absoluteLength + offset;
break;
default:
throw new RuntimeException("Seek: unknown origin: " + seekOrigin);
default:
throw new RuntimeException("Seek: unknown origin: " + seekOrigin);
}
if (newOffset == absoluteOffset && !proceedWithSeek) {

View File

@ -292,6 +292,7 @@ public class GroovyPad extends JFrame {
private class ConsoleOutputStream extends ByteArrayOutputStream {
@Override
public void flush() {
try {
String message = this.toString("UTF-8");

View File

@ -57,7 +57,7 @@ public class ScriptShellMethods {
}
public static List<File> listFiles(File self, Closure<?> closure) {
return (List<File>) DefaultGroovyMethods.findAll(FileUtilities.getChildren(self), closure);
return DefaultGroovyMethods.findAll(FileUtilities.getChildren(self), closure);
}
public static boolean isVideo(File self) {
@ -121,7 +121,7 @@ public class ScriptShellMethods {
List<File> files = FileUtilities.listFiles(roots);
if (closure != null) {
files = (List<File>) DefaultGroovyMethods.findAll(files, closure);
files = DefaultGroovyMethods.findAll(files, closure);
}
return FileUtilities.sortByUniquePath(files);
@ -144,7 +144,7 @@ public class ScriptShellMethods {
List<File> folders = FileUtilities.listFolders(roots);
if (closure != null) {
folders = (List<File>) DefaultGroovyMethods.findAll(folders, closure);
folders = DefaultGroovyMethods.findAll(folders, closure);
}
return FileUtilities.sortByUniquePath(folders);

View File

@ -91,10 +91,10 @@ public class MediaBindingBean {
return getMovie().getName();
if (infoObject instanceof AudioTrack)
return getAlbumArtist() != null ? getAlbumArtist() : getArtist();
if (infoObject instanceof File)
return FileUtilities.getName((File) infoObject);
if (infoObject instanceof File)
return FileUtilities.getName((File) infoObject);
return null;
return null;
}
@Define("y")
@ -909,6 +909,7 @@ public class MediaBindingBean {
private AssociativeScriptObject createBindingObject(File file, Object info, Map<File, Object> context) {
MediaBindingBean mediaBindingBean = new MediaBindingBean(info, file, context) {
@Override
@Define(undefined)
public <T> T undefined(String name) {
return null; // never throw exceptions for empty or null values

View File

@ -284,6 +284,7 @@ public class DropToUnlock extends JList<File> {
return true;
}
@Override
public void handleTransferable(Transferable tr, TransferAction action) throws Exception {
List<File> files = FileTransferable.getFilesFromTransferable(tr);
if (files != null) {
@ -318,6 +319,7 @@ public class DropToUnlock extends JList<File> {
protected static class FileChooserAction extends MouseAdapter {
@Override
public void mouseClicked(MouseEvent evt) {
DropToUnlock list = (DropToUnlock) evt.getSource();
if (evt.getClickCount() > 0) {

View File

@ -33,6 +33,7 @@ public class SmartSeasonEpisodeMatcher extends SeasonEpisodeMatcher {
return super.match(new File(clean(file.getPath())));
}
@Override
public String head(String name) {
return super.head(clean(name));
}

View File

@ -88,6 +88,7 @@ public enum SubtitleMetrics implements SimilarityMetric {
return 0;
}
@Override
protected float similarity(String match, String s1, String s2) {
return match.length() > 0 ? 1 : 0;
}
@ -153,10 +154,12 @@ public enum SubtitleMetrics implements SimilarityMetric {
private final String FPS = "FPS";
private final String SECONDS = "SECS";
@Override
public float getSimilarity(Object o1, Object o2) {
return o1 instanceof SubtitleDescriptor ? super.getSimilarity(o1, o2) : super.getSimilarity(o2, o1); // make sure that SubtitleDescriptor is o1
};
@Override
protected Map<String, Object> getProperties(Object object) {
if (object instanceof OpenSubtitlesSubtitleDescriptor) {
return getSubtitleProperties((OpenSubtitlesSubtitleDescriptor) object);

View File

@ -74,85 +74,85 @@ class BDecoder {
// decide what to do
switch (tempByte) {
case 'd':
// create a new dictionary object
Map<String, Object> tempMap = new HashMap<String, Object>();
case 'd':
// create a new dictionary object
Map<String, Object> tempMap = new HashMap<String, Object>();
// get the key
byte[] tempByteArray = null;
// get the key
byte[] tempByteArray = null;
while ((tempByteArray = (byte[]) decodeInputStream(bais, nesting + 1)) != null) {
while ((tempByteArray = (byte[]) decodeInputStream(bais, nesting + 1)) != null) {
// decode some more
// decode some more
Object value = decodeInputStream(bais, nesting + 1);
Object value = decodeInputStream(bais, nesting + 1);
// add the value to the map
// add the value to the map
CharBuffer cb = BINARY_CHARSET.decode(ByteBuffer.wrap(tempByteArray));
CharBuffer cb = BINARY_CHARSET.decode(ByteBuffer.wrap(tempByteArray));
String key = new String(cb.array(), 0, cb.limit());
String key = new String(cb.array(), 0, cb.limit());
tempMap.put(key, value);
}
if (bais.available() < nesting)
throw (new IOException("BDecoder: invalid input data, 'e' missing from end of dictionary"));
// return the map
return tempMap;
case 'l':
// create the list
List<Object> tempList = new ArrayList<Object>();
// create the key
Object tempElement = null;
while ((tempElement = decodeInputStream(bais, nesting + 1)) != null)
// add the element
tempList.add(tempElement);
if (bais.available() < nesting)
throw (new IOException("BDecoder: invalid input data, 'e' missing from end of list"));
// return the list
return tempList;
case 'e':
case -1:
return null;
case 'i':
return new Long(getNumberFromStream(bais, 'e'));
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
// move back one
bais.reset();
// get the string
return getByteArrayFromStream(bais);
default: {
int rem_len = bais.available();
if (rem_len > 256)
rem_len = 256;
byte[] rem_data = new byte[rem_len];
bais.read(rem_data);
throw (new IOException("BDecoder: unknown command '" + tempByte + ", remainder = " + new String(rem_data)));
tempMap.put(key, value);
}
if (bais.available() < nesting)
throw (new IOException("BDecoder: invalid input data, 'e' missing from end of dictionary"));
// return the map
return tempMap;
case 'l':
// create the list
List<Object> tempList = new ArrayList<Object>();
// create the key
Object tempElement = null;
while ((tempElement = decodeInputStream(bais, nesting + 1)) != null)
// add the element
tempList.add(tempElement);
if (bais.available() < nesting)
throw (new IOException("BDecoder: invalid input data, 'e' missing from end of list"));
// return the list
return tempList;
case 'e':
case -1:
return null;
case 'i':
return new Long(getNumberFromStream(bais, 'e'));
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
// move back one
bais.reset();
// get the string
return getByteArrayFromStream(bais);
default: {
int rem_len = bais.available();
if (rem_len > 256)
rem_len = 256;
byte[] rem_data = new byte[rem_len];
bais.read(rem_data);
throw (new IOException("BDecoder: unknown command '" + tempByte + ", remainder = " + new String(rem_data)));
}
}
}

View File

@ -97,11 +97,13 @@ public class LanguageComboBoxModel extends AbstractListModel implements ComboBox
return data.get(index);
}
@Override
public boolean add(Language element) {
// add first
return addIfAbsent(0, element);
}
@Override
public void add(int index, Language element) {
addIfAbsent(index, element);
}

View File

@ -125,10 +125,12 @@ public class MainFrame extends JFrame {
GroovyPad pad = new GroovyPad();
pad.addWindowListener(new WindowAdapter() {
@Override
public void windowOpened(WindowEvent e) {
MainFrame.this.setVisible(false);
};
@Override
public void windowClosing(WindowEvent e) {
MainFrame.this.setVisible(true);
};

View File

@ -37,6 +37,7 @@ public class AnalyzePanel extends JComponent {
private final PropertyChangeListener filetreeListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
// stopped loading, refresh tools
for (int i = 0; i < toolsPanel.getTabCount(); i++) {

View File

@ -114,6 +114,7 @@ public class FileTree extends JTree {
putValue("files", files);
}
@Override
public void actionPerformed(ActionEvent event) {
UserFiles.revealFiles((Collection<File>) getValue("files"));
}

View File

@ -7,7 +7,6 @@ import static net.filebot.util.FileUtilities.*;
import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
@ -15,8 +14,6 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.BorderFactory;
import javax.swing.JScrollPane;

View File

@ -42,6 +42,7 @@ class MatchAction extends AbstractAction {
putValue(SMALL_ICON, ResourceManager.getIcon(strict ? "action.match.strict" : "action.match"));
}
@Override
public void actionPerformed(ActionEvent evt) {
if (model.names().isEmpty() || model.files().isEmpty()) {
return;

View File

@ -237,6 +237,7 @@ public class PresetEditor extends JDialog {
private final ListCellRenderer<Object> parent = (ListCellRenderer<Object>) combo.getRenderer();
@Override
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
JLabel label = (JLabel) parent.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
@ -278,7 +279,7 @@ public class PresetEditor extends JDialog {
JLabel label = (JLabel) parent.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value instanceof Language) {
Language it = (Language) value;
Language it = value;
label.setText(it.getName());
label.setIcon(ResourceManager.getFlagIcon(it.getCode()));
}

View File

@ -126,6 +126,7 @@ class RenameList<E> extends FileBotList<E> {
private final AbstractAction upAction = new AbstractAction("Align Up", ResourceManager.getIcon("action.up")) {
@Override
public void actionPerformed(ActionEvent e) {
int index = getListComponent().getSelectedIndex();
@ -138,6 +139,7 @@ class RenameList<E> extends FileBotList<E> {
private final AbstractAction downAction = new AbstractAction("Align Down", ResourceManager.getIcon("action.down")) {
@Override
public void actionPerformed(ActionEvent e) {
int index = getListComponent().getSelectedIndex();

View File

@ -274,7 +274,7 @@ public class RenamePanel extends JComponent {
try {
JList list = (JList) evt.getSource();
if (list.getSelectedIndex() >= 0) {
UserFiles.revealFiles((List<File>) list.getSelectedValuesList());
UserFiles.revealFiles(list.getSelectedValuesList());
}
} catch (Exception e) {
Logger.getLogger(RenamePanel.class.getName()).log(Level.WARNING, e.getMessage());
@ -702,6 +702,7 @@ public class RenamePanel extends JComponent {
this.preset = preset;
}
@Override
public List<File> getFiles(ActionEvent evt) {
List<File> input = new ArrayList<File>();
if (preset.getInputFolder() != null) {
@ -725,10 +726,12 @@ public class RenamePanel extends JComponent {
return input;
}
@Override
public boolean isStrict(ActionEvent evt) {
return preset.getMatchMode() != null ? MATCH_MODE_STRICT.equals(preset.getMatchMode()) : super.isStrict(evt);
}
@Override
public SortOrder getSortOrder(ActionEvent evt) {
return preset.getSortOrder() != null ? preset.getSortOrder() : super.getSortOrder(evt);
}

View File

@ -97,10 +97,10 @@ class ChecksumCell {
public State getState() {
if (task != null) {
switch (task.getState()) {
case PENDING:
return State.PENDING;
default:
return State.PROGRESS;
case PENDING:
return State.PENDING;
default:
return State.PROGRESS;
}
}

View File

@ -171,6 +171,7 @@ class ChecksumRow {
private final PropertyChangeListener updateStateListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if ("state".equals(evt.getPropertyName())) {
setState(getState(hashes.values()));

View File

@ -242,6 +242,7 @@ class ChecksumTableModel extends AbstractTableModel {
private final PropertyChangeListener progressListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
ChecksumCell cell = (ChecksumCell) evt.getSource();

View File

@ -32,6 +32,7 @@ class SwingWorkerCellRenderer extends JPanel implements TableCellRenderer {
}
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
setBackground(isSelected ? table.getSelectionBackground() : table.getBackground());

View File

@ -46,6 +46,7 @@ class TotalProgressPanel extends JComponent {
private final DelayedToggle delayed = new DelayedToggle();
@Override
public void propertyChange(PropertyChangeEvent evt) {
final int completedTaskCount = getComputationService(evt).getCompletedTaskCount();
final int totalTaskCount = getComputationService(evt).getTotalTaskCount();
@ -80,6 +81,7 @@ class TotalProgressPanel extends JComponent {
private final ActionListener visibilityActionHandler = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
setVisible(e.getActionCommand() == SHOW);
}

View File

@ -216,6 +216,7 @@ abstract class SubtitleDropTarget extends JButton {
return true;
}
@Override
protected Icon getIcon(DropAction dropAction) {
switch (dropAction) {
case Accept:
@ -307,6 +308,7 @@ abstract class SubtitleDropTarget extends JButton {
return null;
}
@Override
protected Icon getIcon(DropAction dropAction) {
if (dropAction == DropAction.Accept)
return ResourceManager.getIcon("subtitle.exact.upload");

View File

@ -59,16 +59,16 @@ class SubtitlePackageCellRenderer extends AbstractFancyListCellRenderer {
private Icon getIcon(SubtitlePackage subtitle) {
switch (subtitle.getDownload().getPhase()) {
case PENDING:
return ResourceManager.getIcon("bullet.green");
case WAITING:
return ResourceManager.getIcon("worker.pending");
case DOWNLOADING:
return ResourceManager.getIcon("package.fetch");
case EXTRACTING:
return ResourceManager.getIcon("package.extract");
case DONE:
return ResourceManager.getIcon("status.ok");
case PENDING:
return ResourceManager.getIcon("bullet.green");
case WAITING:
return ResourceManager.getIcon("worker.pending");
case DOWNLOADING:
return ResourceManager.getIcon("package.fetch");
case EXTRACTING:
return ResourceManager.getIcon("package.extract");
case DONE:
return ResourceManager.getIcon("status.ok");
}
// unreachable

View File

@ -73,6 +73,7 @@ public class SubtitlePanel extends AbstractSearchPanel<SubtitleProvider, Subtitl
private final SubtitleDropTarget uploadDropTarget = new SubtitleDropTarget.Upload() {
@Override
public OpenSubtitlesClient getSubtitleService() {
return WebServices.OpenSubtitles;
};
@ -114,6 +115,7 @@ public class SubtitlePanel extends AbstractSearchPanel<SubtitleProvider, Subtitl
return WebServices.getSubtitleProviders();
}
@Override
public OpenSubtitlesClient getSubtitleService() {
return WebServices.OpenSubtitles;
};
@ -149,6 +151,7 @@ public class SubtitlePanel extends AbstractSearchPanel<SubtitleProvider, Subtitl
}
};
@Override
protected Collection<String> getHistory(SubtitleProvider engine) throws Exception {
List<String> names = new ArrayList<String>();
for (SubtitleSearchResult it : MediaDetection.releaseInfo.getOpenSubtitlesIndex()) {

View File

@ -61,7 +61,6 @@ import net.filebot.web.Movie;
import net.filebot.web.OpenSubtitlesClient;
import net.filebot.web.SearchResult;
import net.filebot.web.SubtitleSearchResult;
import net.filebot.web.TheTVDBSearchResult;
import net.filebot.web.TheTVDBSeriesInfo;
import net.filebot.web.VideoHashSubtitleService.CheckResult;
import net.miginfocom.swing.MigLayout;
@ -690,7 +689,7 @@ public class SubtitleUploadDialog extends JDialog {
for (String name : seriesNames) {
List<SearchResult> options = WebServices.TheTVDB.search(name, Locale.ENGLISH);
for (SearchResult entry : options) {
TheTVDBSeriesInfo seriesInfo = (TheTVDBSeriesInfo) WebServices.TheTVDB.getSeriesInfo((TheTVDBSearchResult) entry, Locale.ENGLISH);
TheTVDBSeriesInfo seriesInfo = (TheTVDBSeriesInfo) WebServices.TheTVDB.getSeriesInfo(entry, Locale.ENGLISH);
if (seriesInfo.getImdbId() != null) {
int imdbId = grepImdbId(seriesInfo.getImdbId()).iterator().next();
mapping.setIdentity(WebServices.OpenSubtitles.getMovieDescriptor(new Movie(null, 0, imdbId, -1), Locale.ENGLISH));

View File

@ -39,6 +39,7 @@ public class LoadAction extends AbstractAction {
return null;
}
@Override
public void actionPerformed(ActionEvent evt) {
try {
// get transferable policy from action properties

View File

@ -45,6 +45,7 @@ public class SaveAction extends AbstractAction {
return new File(validateFileName(getExportHandler().getDefaultFileName()));
}
@Override
public void actionPerformed(ActionEvent evt) {
try {
if (canExport()) {

View File

@ -14,12 +14,14 @@ import javax.swing.TransferHandler;
public abstract class TextFileExportHandler implements TransferableExportHandler, FileExportHandler {
@Override
public abstract boolean canExport();
public abstract void export(PrintWriter out);
@Override
public abstract String getDefaultFileName();

View File

@ -36,6 +36,7 @@ public class DefaultThreadFactory implements ThreadFactory {
}
@Override
public Thread newThread(Runnable r) {
Thread thread = new Thread(group, r, String.format("%s-thread-%d", group.getName(), threadNumber.incrementAndGet()));

View File

@ -20,6 +20,7 @@ public class ListChangeSynchronizer<E> implements ListEventListener<E> {
}
@Override
public void listChanged(ListEvent<E> listChanges) {
EventList<E> source = listChanges.getSourceList();
@ -29,15 +30,15 @@ public class ListChangeSynchronizer<E> implements ListEventListener<E> {
int type = listChanges.getType();
switch (type) {
case ListEvent.INSERT:
target.add(index, source.get(index));
break;
case ListEvent.UPDATE:
target.set(index, source.get(index));
break;
case ListEvent.DELETE:
target.remove(index);
break;
case ListEvent.INSERT:
target.add(index, source.get(index));
break;
case ListEvent.UPDATE:
target.set(index, source.get(index));
break;
case ListEvent.DELETE:
target.remove(index);
break;
}
}
}

View File

@ -58,50 +58,62 @@ public class UnicodeReader extends Reader {
}
}
@Override
public int hashCode() {
return reader.hashCode();
}
@Override
public int read(CharBuffer target) throws IOException {
return reader.read(target);
}
@Override
public boolean equals(Object obj) {
return reader.equals(obj);
}
@Override
public int read(char[] cbuf) throws IOException {
return reader.read(cbuf);
}
@Override
public int read() throws IOException {
return reader.read();
}
@Override
public int read(char[] cbuf, int offset, int length) throws IOException {
return reader.read(cbuf, offset, length);
}
@Override
public long skip(long n) throws IOException {
return reader.skip(n);
}
@Override
public boolean ready() throws IOException {
return reader.ready();
}
@Override
public void close() throws IOException {
reader.close();
}
@Override
public boolean markSupported() {
return reader.markSupported();
}
@Override
public void mark(int readAheadLimit) throws IOException {
reader.mark(readAheadLimit);
}
@Override
public void reset() throws IOException {
reader.reset();
}

View File

@ -26,11 +26,13 @@ public class FilePreferencesFactory implements PreferencesFactory {
public static final String SYSTEM_PROPERTY_FILE = "net.filebot.util.prefs.file";
@Override
public Preferences systemRoot() {
return userRoot();
}
@Override
public Preferences userRoot() {
if (rootPreferences == null) {
rootPreferences = new FilePreferences(null, "");

View File

@ -24,48 +24,48 @@ public enum GradientStyle {
Point2D end = null;
switch (this) {
case BOTTOM_TO_TOP:
start = new Point2D.Double(shape.getCenterX(), shape.getMaxY());
end = new Point2D.Double(shape.getCenterX(), shape.getMinY());
break;
case BOTTOM_TO_TOP:
start = new Point2D.Double(shape.getCenterX(), shape.getMaxY());
end = new Point2D.Double(shape.getCenterX(), shape.getMinY());
break;
case TOP_TO_BOTTOM:
end = new Point2D.Double(shape.getCenterX(), shape.getMaxY());
start = new Point2D.Double(shape.getCenterX(), shape.getMinY());
break;
case TOP_TO_BOTTOM:
end = new Point2D.Double(shape.getCenterX(), shape.getMaxY());
start = new Point2D.Double(shape.getCenterX(), shape.getMinY());
break;
case LEFT_TO_RIGHT:
start = new Point2D.Double(shape.getMinX(), shape.getCenterY());
end = new Point2D.Double(shape.getMaxX(), shape.getCenterY());
break;
case LEFT_TO_RIGHT:
start = new Point2D.Double(shape.getMinX(), shape.getCenterY());
end = new Point2D.Double(shape.getMaxX(), shape.getCenterY());
break;
case RIGHT_TO_LEFT:
end = new Point2D.Double(shape.getMinX(), shape.getCenterY());
start = new Point2D.Double(shape.getMaxX(), shape.getCenterY());
break;
case RIGHT_TO_LEFT:
end = new Point2D.Double(shape.getMinX(), shape.getCenterY());
start = new Point2D.Double(shape.getMaxX(), shape.getCenterY());
break;
case TOP_LEFT_TO_BOTTOM_RIGHT:
start = new Point2D.Double(shape.getMinX(), shape.getMinY());
end = new Point2D.Double(shape.getMaxX(), shape.getMaxY());
break;
case TOP_LEFT_TO_BOTTOM_RIGHT:
start = new Point2D.Double(shape.getMinX(), shape.getMinY());
end = new Point2D.Double(shape.getMaxX(), shape.getMaxY());
break;
case BOTTOM_RIGHT_TO_TOP_LEFT:
end = new Point2D.Double(shape.getMinX(), shape.getMinY());
start = new Point2D.Double(shape.getMaxX(), shape.getMaxY());
break;
case BOTTOM_RIGHT_TO_TOP_LEFT:
end = new Point2D.Double(shape.getMinX(), shape.getMinY());
start = new Point2D.Double(shape.getMaxX(), shape.getMaxY());
break;
case TOP_RIGHT_TO_BOTTOM_LEFT:
start = new Point2D.Double(shape.getMaxX(), shape.getMinY());
end = new Point2D.Double(shape.getMinX(), shape.getMaxY());
break;
case TOP_RIGHT_TO_BOTTOM_LEFT:
start = new Point2D.Double(shape.getMaxX(), shape.getMinY());
end = new Point2D.Double(shape.getMinX(), shape.getMaxY());
break;
case BOTTOM_LEFT_TO_TOP_RIGHT:
end = new Point2D.Double(shape.getMaxX(), shape.getMinY());
start = new Point2D.Double(shape.getMinX(), shape.getMaxY());
break;
case BOTTOM_LEFT_TO_TOP_RIGHT:
end = new Point2D.Double(shape.getMaxX(), shape.getMinY());
start = new Point2D.Double(shape.getMinX(), shape.getMaxY());
break;
default:
return null;
default:
return null;
}
Color[] colors = { gradientBeginColor, gradientEndColor };

View File

@ -148,6 +148,7 @@ public class ListView extends JList {
private Point origin;
@Override
public void mousePressed(MouseEvent e) {
if (SwingUtilities.isLeftMouseButton(e) && !isSelectedIndex(locationToIndex(e.getPoint()))) {
origin = e.getPoint();

View File

@ -226,6 +226,7 @@ public class SelectButton<T> extends JButton {
this.icon = icon;
}
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
Graphics2D g2d = (Graphics2D) g;
@ -237,10 +238,12 @@ public class SelectButton<T> extends JButton {
g2d.fill(arrow);
}
@Override
public int getIconWidth() {
return 30;
}
@Override
public int getIconHeight() {
return 20;
}

View File

@ -110,24 +110,24 @@ public class ShadowBorder extends AbstractBorder {
Point2D center = null;
switch (this) {
case TOP_LEFT:
center = new Point2D.Double(shape.getX() + radius, shape.getY() + radius);
break;
case TOP_LEFT:
center = new Point2D.Double(shape.getX() + radius, shape.getY() + radius);
break;
case TOP_RIGHT:
center = new Point2D.Double(shape.getX() + 0, shape.getY() + radius);
break;
case TOP_RIGHT:
center = new Point2D.Double(shape.getX() + 0, shape.getY() + radius);
break;
case BOTTOM_LEFT:
center = new Point2D.Double(shape.getX() + radius, shape.getY() + 0);
break;
case BOTTOM_LEFT:
center = new Point2D.Double(shape.getX() + radius, shape.getY() + 0);
break;
case BOTTOM_RIGHT:
center = new Point2D.Double(shape.getX() + 0, shape.getY() + 0);
break;
case BOTTOM_RIGHT:
center = new Point2D.Double(shape.getX() + 0, shape.getY() + 0);
break;
default:
return null;
default:
return null;
}
float[] dist = { 0.0f, 1.0f };

View File

@ -10,6 +10,7 @@ import javax.swing.SwingWorker.StateValue;
public abstract class SwingWorkerPropertyChangeAdapter implements PropertyChangeListener {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getPropertyName().equals("progress")) {
progress(evt);
@ -23,12 +24,12 @@ public abstract class SwingWorkerPropertyChangeAdapter implements PropertyChange
protected void state(PropertyChangeEvent evt) {
switch ((StateValue) evt.getNewValue()) {
case STARTED:
started(evt);
break;
case DONE:
done(evt);
break;
case STARTED:
started(evt);
break;
case DONE:
done(evt);
break;
}
}

View File

@ -80,6 +80,7 @@ public class QueueNotificationLayout implements NotificationLayout {
}
@Override
public void add(NotificationWindow notification) {
notifications.add(notification);
align(notification.getGraphicsConfiguration());
@ -103,6 +104,7 @@ public class QueueNotificationLayout implements NotificationLayout {
}
@Override
public void remove(NotificationWindow notification) {
if (notifications.remove(notification)) {
align(notification.getGraphicsConfiguration());

View File

@ -36,40 +36,40 @@ public class SeparatorBorder extends AbstractBorder {
public Rectangle2D getRectangle(RectangularShape shape, int borderWidth) {
switch (this) {
case TOP:
return new Rectangle2D.Double(shape.getX(), shape.getY(), shape.getWidth(), borderWidth);
case BOTTOM:
return new Rectangle2D.Double(shape.getX(), shape.getMaxY() - borderWidth, shape.getWidth(), borderWidth);
case LEFT:
return new Rectangle2D.Double(shape.getX(), shape.getY(), borderWidth, shape.getHeight());
case RIGHT:
return new Rectangle2D.Double(shape.getMaxX() - borderWidth, shape.getY(), borderWidth, shape.getHeight());
default:
return null;
case TOP:
return new Rectangle2D.Double(shape.getX(), shape.getY(), shape.getWidth(), borderWidth);
case BOTTOM:
return new Rectangle2D.Double(shape.getX(), shape.getMaxY() - borderWidth, shape.getWidth(), borderWidth);
case LEFT:
return new Rectangle2D.Double(shape.getX(), shape.getY(), borderWidth, shape.getHeight());
case RIGHT:
return new Rectangle2D.Double(shape.getMaxX() - borderWidth, shape.getY(), borderWidth, shape.getHeight());
default:
return null;
}
}
public Insets getInsets(Insets insets, int borderWidth) {
switch (this) {
case TOP:
insets.top = borderWidth;
insets.left = insets.right = insets.bottom = 0;
return insets;
case BOTTOM:
insets.bottom = borderWidth;
insets.left = insets.right = insets.top = 0;
return insets;
case LEFT:
insets.left = borderWidth;
insets.right = insets.top = insets.bottom = 0;
return insets;
case RIGHT:
insets.right = borderWidth;
insets.left = insets.top = insets.bottom = 0;
return insets;
default:
return null;
case TOP:
insets.top = borderWidth;
insets.left = insets.right = insets.bottom = 0;
return insets;
case BOTTOM:
insets.bottom = borderWidth;
insets.left = insets.right = insets.top = 0;
return insets;
case LEFT:
insets.left = borderWidth;
insets.right = insets.top = insets.bottom = 0;
return insets;
case RIGHT:
insets.right = borderWidth;
insets.left = insets.top = insets.bottom = 0;
return insets;
default:
return null;
}
}
}

View File

@ -55,6 +55,7 @@ public class SimpleNotificationLayout implements NotificationLayout {
}
@Override
public void add(NotificationWindow notification) {
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(notification.getGraphicsConfiguration());
@ -71,6 +72,7 @@ public class SimpleNotificationLayout implements NotificationLayout {
}
@Override
public void remove(NotificationWindow notification) {
}

View File

@ -20,6 +20,7 @@ public class SimpleFileInfo implements FileInfo, Comparable<FileInfo> {
return path;
}
@Override
public String getName() {
return getNameWithoutExtension(new File(path).getName());
}
@ -29,6 +30,7 @@ public class SimpleFileInfo implements FileInfo, Comparable<FileInfo> {
return getExtension(path);
}
@Override
public long getLength() {
return length;
}

View File

@ -54,6 +54,7 @@ public abstract class AbstractEpisodeListProvider implements EpisodeListProvider
return getSeriesData(searchResult, null, language).getSeriesInfo();
}
@Override
public SeriesInfo getSeriesInfo(int id, Locale language) throws Exception {
return getSeriesInfo(createSearchResult(id), language);
}

View File

@ -131,7 +131,7 @@ public class AcoustIDClient implements MusicIdentificationService {
}
public AudioTrack parseResult(String json, final int targetDuration) throws IOException {
Map<?, ?> data = (Map<?, ?>) JsonReader.jsonToMaps(json);
Map<?, ?> data = JsonReader.jsonToMaps(json);
if (!data.get("status").equals("ok")) {
throw new IOException("acoustid responded with error: " + data.get("status"));

View File

@ -371,7 +371,7 @@ public class OpenSubtitlesClient implements SubtitleProvider, VideoHashSubtitleS
// search for movies and series
List<SubtitleSearchResult> result = getCache().getSearchResult("search", query);
if (result != null) {
return (List<SubtitleSearchResult>) result;
return result;
}
// require login
@ -469,7 +469,7 @@ public class OpenSubtitlesClient implements SubtitleProvider, VideoHashSubtitleS
@Override
public URI getSubtitleListLink(SubtitleSearchResult searchResult, String languageName) {
Movie movie = (Movie) searchResult;
Movie movie = searchResult;
String sublanguageid = "all";
if (languageName != null) {

View File

@ -334,6 +334,7 @@ public class OpenSubtitlesXmlRpc {
protected Map<?, ?> invoke(String method, Object... arguments) throws XmlRpcFault {
try {
XmlRpcClient rpc = new XmlRpcClient(getXmlRpcUrl(), false) {
@Override
public void parse(InputStream input) throws XmlRpcException {
try {
super.parse(new GZIPInputStream(input));

View File

@ -9,12 +9,14 @@ import net.filebot.vfs.FileInfo;
public interface SubtitleDescriptor extends FileInfo {
@Override
String getName();
String getLanguageName();
@Override
String getType();

View File

@ -314,6 +314,7 @@ public class TheTVDBClient extends AbstractEpisodeListProvider {
protected Document getXmlResource(final MirrorType mirrorType, final String path) throws IOException {
CachedXmlResource resource = new CachedXmlResource(path) {
@Override
protected URL getResourceLocation(String path) throws IOException {
return getResourceURL(mirrorType, path);
};