* try to fix Mac keyEvent issues
This commit is contained in:
parent
c6433e5c81
commit
1372944851
|
@ -9,6 +9,7 @@ import static net.sourceforge.tuned.ui.TunedUtilities.*;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Window;
|
import java.awt.Window;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
@ -30,11 +31,6 @@ import javax.swing.SwingWorker;
|
||||||
import javax.swing.event.ChangeEvent;
|
import javax.swing.event.ChangeEvent;
|
||||||
import javax.swing.event.ChangeListener;
|
import javax.swing.event.ChangeListener;
|
||||||
|
|
||||||
import ca.odell.glazedlists.BasicEventList;
|
|
||||||
import ca.odell.glazedlists.EventList;
|
|
||||||
import ca.odell.glazedlists.matchers.TextMatcherEditor;
|
|
||||||
import ca.odell.glazedlists.swing.AutoCompleteSupport;
|
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import net.sourceforge.filebot.ResourceManager;
|
import net.sourceforge.filebot.ResourceManager;
|
||||||
import net.sourceforge.filebot.Settings;
|
import net.sourceforge.filebot.Settings;
|
||||||
|
@ -43,6 +39,10 @@ import net.sourceforge.filebot.web.SearchResult;
|
||||||
import net.sourceforge.tuned.ExceptionUtilities;
|
import net.sourceforge.tuned.ExceptionUtilities;
|
||||||
import net.sourceforge.tuned.ListChangeSynchronizer;
|
import net.sourceforge.tuned.ListChangeSynchronizer;
|
||||||
import net.sourceforge.tuned.ui.LabelProvider;
|
import net.sourceforge.tuned.ui.LabelProvider;
|
||||||
|
import ca.odell.glazedlists.BasicEventList;
|
||||||
|
import ca.odell.glazedlists.EventList;
|
||||||
|
import ca.odell.glazedlists.matchers.TextMatcherEditor;
|
||||||
|
import ca.odell.glazedlists.swing.AutoCompleteSupport;
|
||||||
|
|
||||||
|
|
||||||
public abstract class AbstractSearchPanel<S, E> extends JComponent {
|
public abstract class AbstractSearchPanel<S, E> extends JComponent {
|
||||||
|
@ -99,7 +99,7 @@ public abstract class AbstractSearchPanel<S, E> extends JComponent {
|
||||||
|
|
||||||
AutoCompleteSupport.install(searchTextField.getEditor(), searchHistory).setFilterMode(TextMatcherEditor.CONTAINS);
|
AutoCompleteSupport.install(searchTextField.getEditor(), searchHistory).setFilterMode(TextMatcherEditor.CONTAINS);
|
||||||
|
|
||||||
installAction(this, KeyStroke.getKeyStroke("ENTER"), searchAction);
|
installAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), searchAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -148,9 +148,9 @@ public abstract class AbstractSearchPanel<S, E> extends JComponent {
|
||||||
return history;
|
return history;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private final AbstractAction searchAction = new AbstractAction("Find", ResourceManager.getIcon("action.find")) {
|
private final AbstractAction searchAction = new AbstractAction("Find", ResourceManager.getIcon("action.find")) {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (e.getActionCommand() == null) {
|
if (e.getActionCommand() == null) {
|
||||||
// command triggered by auto-completion
|
// command triggered by auto-completion
|
||||||
|
|
|
@ -4,6 +4,7 @@ package net.sourceforge.filebot.ui;
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
|
|
||||||
import javax.swing.AbstractAction;
|
import javax.swing.AbstractAction;
|
||||||
import javax.swing.Action;
|
import javax.swing.Action;
|
||||||
|
@ -48,8 +49,8 @@ public class FileBotList<E> extends JComponent {
|
||||||
// Shortcut DELETE, disabled by default
|
// Shortcut DELETE, disabled by default
|
||||||
removeAction.setEnabled(false);
|
removeAction.setEnabled(false);
|
||||||
|
|
||||||
TunedUtilities.installAction(this, KeyStroke.getKeyStroke("pressed DELETE"), removeAction);
|
TunedUtilities.installAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), removeAction);
|
||||||
TunedUtilities.installAction(this, KeyStroke.getKeyStroke("pressed BACK_SPACE"), removeAction);
|
TunedUtilities.installAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0), removeAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -126,6 +127,7 @@ public class FileBotList<E> extends JComponent {
|
||||||
|
|
||||||
private final AbstractAction removeAction = new AbstractAction("Remove") {
|
private final AbstractAction removeAction = new AbstractAction("Remove") {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
int index = list.getSelectedIndex();
|
int index = list.getSelectedIndex();
|
||||||
Object values[] = list.getSelectedValues();
|
Object values[] = list.getSelectedValues();
|
||||||
|
|
|
@ -8,6 +8,7 @@ import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.awt.event.FocusEvent;
|
import java.awt.event.FocusEvent;
|
||||||
import java.awt.event.FocusListener;
|
import java.awt.event.FocusListener;
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
@ -53,8 +54,8 @@ public class SelectButtonTextField<T> extends JComponent {
|
||||||
editor.setRenderer(new CompletionCellRenderer());
|
editor.setRenderer(new CompletionCellRenderer());
|
||||||
editor.setUI(new TextFieldComboBoxUI());
|
editor.setUI(new TextFieldComboBoxUI());
|
||||||
|
|
||||||
TunedUtilities.installAction(this, KeyStroke.getKeyStroke("ctrl UP"), new SpinClientAction(-1));
|
TunedUtilities.installAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_UP, KeyEvent.CTRL_MASK), new SpinClientAction(-1));
|
||||||
TunedUtilities.installAction(this, KeyStroke.getKeyStroke("ctrl DOWN"), new SpinClientAction(1));
|
TunedUtilities.installAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, KeyEvent.CTRL_MASK), new SpinClientAction(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,6 +75,7 @@ public class SelectButtonTextField<T> extends JComponent {
|
||||||
|
|
||||||
private final ActionListener textFieldFocusOnClick = new ActionListener() {
|
private final ActionListener textFieldFocusOnClick = new ActionListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
getEditor().requestFocus();
|
getEditor().requestFocus();
|
||||||
}
|
}
|
||||||
|
@ -92,6 +94,7 @@ public class SelectButtonTextField<T> extends JComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
selectButton.spinValue(spin);
|
selectButton.spinValue(spin);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import static net.sourceforge.tuned.ui.TunedUtilities.*;
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
import java.awt.event.MouseAdapter;
|
import java.awt.event.MouseAdapter;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
@ -77,7 +78,7 @@ public class SelectDialog<T> extends JDialog {
|
||||||
setSize(new Dimension(210, 210));
|
setSize(new Dimension(210, 210));
|
||||||
|
|
||||||
// Shortcut Enter
|
// Shortcut Enter
|
||||||
TunedUtilities.installAction(list, KeyStroke.getKeyStroke("ENTER"), selectAction);
|
TunedUtilities.installAction(list, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), selectAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -115,9 +116,9 @@ public class SelectDialog<T> extends JDialog {
|
||||||
return cancelAction;
|
return cancelAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private final Action selectAction = new AbstractAction("Select", ResourceManager.getIcon("dialog.continue")) {
|
private final Action selectAction = new AbstractAction("Select", ResourceManager.getIcon("dialog.continue")) {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
valueSelected = true;
|
valueSelected = true;
|
||||||
close();
|
close();
|
||||||
|
@ -126,6 +127,7 @@ public class SelectDialog<T> extends JDialog {
|
||||||
|
|
||||||
private final Action cancelAction = new AbstractAction("Cancel", ResourceManager.getIcon("dialog.cancel")) {
|
private final Action cancelAction = new AbstractAction("Cancel", ResourceManager.getIcon("dialog.cancel")) {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
valueSelected = false;
|
valueSelected = false;
|
||||||
close();
|
close();
|
||||||
|
|
|
@ -5,6 +5,7 @@ package net.sourceforge.filebot.ui.analyze;
|
||||||
import static net.sourceforge.filebot.ui.transfer.BackgroundFileTransferablePolicy.*;
|
import static net.sourceforge.filebot.ui.transfer.BackgroundFileTransferablePolicy.*;
|
||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
import java.beans.PropertyChangeEvent;
|
import java.beans.PropertyChangeEvent;
|
||||||
import java.beans.PropertyChangeListener;
|
import java.beans.PropertyChangeListener;
|
||||||
|
|
||||||
|
@ -54,6 +55,7 @@ class FileTreePanel extends JComponent {
|
||||||
// update tree when loading is finished
|
// update tree when loading is finished
|
||||||
transferablePolicy.addPropertyChangeListener(new PropertyChangeListener() {
|
transferablePolicy.addPropertyChangeListener(new PropertyChangeListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void propertyChange(PropertyChangeEvent evt) {
|
public void propertyChange(PropertyChangeEvent evt) {
|
||||||
if (LOADING_PROPERTY.equals(evt.getPropertyName()) && !(Boolean) evt.getNewValue()) {
|
if (LOADING_PROPERTY.equals(evt.getPropertyName()) && !(Boolean) evt.getNewValue()) {
|
||||||
fireFileTreeChange();
|
fireFileTreeChange();
|
||||||
|
@ -62,8 +64,8 @@ class FileTreePanel extends JComponent {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Shortcut DELETE
|
// Shortcut DELETE
|
||||||
TunedUtilities.installAction(fileTree, KeyStroke.getKeyStroke("DELETE"), removeAction);
|
TunedUtilities.installAction(fileTree, KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), removeAction);
|
||||||
TunedUtilities.installAction(fileTree, KeyStroke.getKeyStroke("BACK_SPACE"), removeAction);
|
TunedUtilities.installAction(fileTree, KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0), removeAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -76,11 +78,11 @@ class FileTreePanel extends JComponent {
|
||||||
return transferablePolicy;
|
return transferablePolicy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private final LoadAction loadAction = new LoadAction(transferablePolicy);
|
private final LoadAction loadAction = new LoadAction(transferablePolicy);
|
||||||
|
|
||||||
private final AbstractAction clearAction = new AbstractAction("Clear", ResourceManager.getIcon("action.clear")) {
|
private final AbstractAction clearAction = new AbstractAction("Clear", ResourceManager.getIcon("action.clear")) {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
transferablePolicy.reset();
|
transferablePolicy.reset();
|
||||||
fileTree.clear();
|
fileTree.clear();
|
||||||
|
@ -90,6 +92,7 @@ class FileTreePanel extends JComponent {
|
||||||
|
|
||||||
private final AbstractAction removeAction = new AbstractAction("Remove") {
|
private final AbstractAction removeAction = new AbstractAction("Remove") {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (fileTree.getSelectionCount() < 1)
|
if (fileTree.getSelectionCount() < 1)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -9,6 +9,7 @@ import java.awt.datatransfer.Clipboard;
|
||||||
import java.awt.datatransfer.StringSelection;
|
import java.awt.datatransfer.StringSelection;
|
||||||
import java.awt.datatransfer.Transferable;
|
import java.awt.datatransfer.Transferable;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
import java.beans.PropertyChangeEvent;
|
import java.beans.PropertyChangeEvent;
|
||||||
import java.beans.PropertyChangeListener;
|
import java.beans.PropertyChangeListener;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -81,8 +82,8 @@ public class EpisodeListPanel extends AbstractSearchPanel<EpisodeListProvider, E
|
||||||
|
|
||||||
searchTextField.getSelectButton().addPropertyChangeListener(SelectButton.SELECTED_VALUE, selectButtonListener);
|
searchTextField.getSelectButton().addPropertyChangeListener(SelectButton.SELECTED_VALUE, selectButtonListener);
|
||||||
|
|
||||||
TunedUtilities.installAction(this, KeyStroke.getKeyStroke("shift UP"), new SpinSeasonAction(1));
|
TunedUtilities.installAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_UP, KeyEvent.SHIFT_MASK), new SpinSeasonAction(1));
|
||||||
TunedUtilities.installAction(this, KeyStroke.getKeyStroke("shift DOWN"), new SpinSeasonAction(-1));
|
TunedUtilities.installAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, KeyEvent.SHIFT_MASK), new SpinSeasonAction(-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -115,9 +116,9 @@ public class EpisodeListPanel extends AbstractSearchPanel<EpisodeListProvider, E
|
||||||
return new EpisodeListRequestProcessor(new EpisodeListRequest(provider, text, season, order, language));
|
return new EpisodeListRequestProcessor(new EpisodeListRequest(provider, text, season, order, language));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
private final PropertyChangeListener selectButtonListener = new PropertyChangeListener() {
|
private final PropertyChangeListener selectButtonListener = new PropertyChangeListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void propertyChange(PropertyChangeEvent evt) {
|
public void propertyChange(PropertyChangeEvent evt) {
|
||||||
EpisodeListProvider provider = searchTextField.getSelectButton().getSelectedValue();
|
EpisodeListProvider provider = searchTextField.getSelectButton().getSelectedValue();
|
||||||
|
|
||||||
|
@ -139,6 +140,7 @@ public class EpisodeListPanel extends AbstractSearchPanel<EpisodeListProvider, E
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
seasonSpinnerModel.spin((Integer) getValue("spin"));
|
seasonSpinnerModel.spin((Integer) getValue("spin"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import static net.sourceforge.filebot.ui.NotificationLogging.*;
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
@ -84,12 +85,13 @@ public class ListPanel extends JComponent {
|
||||||
|
|
||||||
list.add(buttonPanel, BorderLayout.SOUTH);
|
list.add(buttonPanel, BorderLayout.SOUTH);
|
||||||
|
|
||||||
TunedUtilities.installAction(this, KeyStroke.getKeyStroke("ENTER"), createAction);
|
TunedUtilities.installAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), createAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private AbstractAction createAction = new AbstractAction("Create") {
|
private AbstractAction createAction = new AbstractAction("Create") {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void actionPerformed(ActionEvent evt) {
|
public void actionPerformed(ActionEvent evt) {
|
||||||
|
|
||||||
// clear selection
|
// clear selection
|
||||||
|
|
|
@ -14,6 +14,7 @@ import java.awt.Desktop;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
import java.awt.Window;
|
import java.awt.Window;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
import java.awt.event.WindowAdapter;
|
import java.awt.event.WindowAdapter;
|
||||||
import java.awt.event.WindowEvent;
|
import java.awt.event.WindowEvent;
|
||||||
import java.beans.PropertyChangeEvent;
|
import java.beans.PropertyChangeEvent;
|
||||||
|
@ -100,8 +101,7 @@ class FormatDialog extends JDialog {
|
||||||
|
|
||||||
|
|
||||||
public enum Mode {
|
public enum Mode {
|
||||||
Episode,
|
Episode, Movie;
|
||||||
Movie;
|
|
||||||
|
|
||||||
public Mode next() {
|
public Mode next() {
|
||||||
if (ordinal() < values().length - 1)
|
if (ordinal() < values().length - 1)
|
||||||
|
@ -200,7 +200,7 @@ class FormatDialog extends JDialog {
|
||||||
});
|
});
|
||||||
|
|
||||||
// install editor suggestions popup
|
// install editor suggestions popup
|
||||||
TunedUtilities.installAction(editor, KeyStroke.getKeyStroke("pressed DOWN"), displayRecentFormatHistory);
|
TunedUtilities.installAction(editor, KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), displayRecentFormatHistory);
|
||||||
|
|
||||||
// episode mode by default
|
// episode mode by default
|
||||||
setMode(Mode.Episode);
|
setMode(Mode.Episode);
|
||||||
|
@ -539,7 +539,6 @@ class FormatDialog extends JDialog {
|
||||||
dispose();
|
dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected final Action changeSampleAction = new AbstractAction("Change Sample", ResourceManager.getIcon("action.variable")) {
|
protected final Action changeSampleAction = new AbstractAction("Change Sample", ResourceManager.getIcon("action.variable")) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -12,6 +12,7 @@ import java.awt.Component;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Window;
|
import java.awt.Window;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.AbstractList;
|
import java.util.AbstractList;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -93,7 +94,7 @@ class ValidateDialog extends JDialog {
|
||||||
content.add(new JButton(continueAction), "gap related");
|
content.add(new JButton(continueAction), "gap related");
|
||||||
content.add(new JButton(cancelAction), "gap 12mm");
|
content.add(new JButton(cancelAction), "gap 12mm");
|
||||||
|
|
||||||
installAction(content, KeyStroke.getKeyStroke("ESCAPE"), cancelAction);
|
installAction(content, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), cancelAction);
|
||||||
|
|
||||||
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||||
setMinimumSize(new Dimension(365, 280));
|
setMinimumSize(new Dimension(365, 280));
|
||||||
|
@ -118,7 +119,6 @@ class ValidateDialog extends JDialog {
|
||||||
dispose();
|
dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private final Action validateAction = new AbstractAction("Validate", ResourceManager.getIcon("dialog.continue")) {
|
private final Action validateAction = new AbstractAction("Validate", ResourceManager.getIcon("dialog.continue")) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -7,6 +7,7 @@ import static net.sourceforge.filebot.ui.sfv.ChecksumTableModel.*;
|
||||||
import static net.sourceforge.filebot.ui.transfer.BackgroundFileTransferablePolicy.*;
|
import static net.sourceforge.filebot.ui.transfer.BackgroundFileTransferablePolicy.*;
|
||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
import java.beans.PropertyChangeEvent;
|
import java.beans.PropertyChangeEvent;
|
||||||
import java.beans.PropertyChangeListener;
|
import java.beans.PropertyChangeListener;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -90,8 +91,8 @@ public class SfvPanel extends JComponent {
|
||||||
putClientProperty("transferablePolicy", transferablePolicy);
|
putClientProperty("transferablePolicy", transferablePolicy);
|
||||||
|
|
||||||
// Shortcut DELETE
|
// Shortcut DELETE
|
||||||
TunedUtilities.installAction(this, KeyStroke.getKeyStroke("DELETE"), removeAction);
|
TunedUtilities.installAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), removeAction);
|
||||||
TunedUtilities.installAction(this, KeyStroke.getKeyStroke("BACK_SPACE"), removeAction);
|
TunedUtilities.installAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0), removeAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -128,13 +129,13 @@ public class SfvPanel extends JComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private final SaveAction saveAction = new ChecksumTableSaveAction();
|
private final SaveAction saveAction = new ChecksumTableSaveAction();
|
||||||
|
|
||||||
private final LoadAction loadAction = new LoadAction(transferablePolicy);
|
private final LoadAction loadAction = new LoadAction(transferablePolicy);
|
||||||
|
|
||||||
private final AbstractAction clearAction = new AbstractAction("Clear", ResourceManager.getIcon("action.clear")) {
|
private final AbstractAction clearAction = new AbstractAction("Clear", ResourceManager.getIcon("action.clear")) {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
transferablePolicy.reset();
|
transferablePolicy.reset();
|
||||||
computationService.reset();
|
computationService.reset();
|
||||||
|
@ -145,6 +146,7 @@ public class SfvPanel extends JComponent {
|
||||||
|
|
||||||
private final AbstractAction removeAction = new AbstractAction("Remove") {
|
private final AbstractAction removeAction = new AbstractAction("Remove") {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (table.getSelectedRowCount() < 1)
|
if (table.getSelectedRowCount() < 1)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -9,6 +9,7 @@ import static net.sourceforge.tuned.FileUtilities.*;
|
||||||
import static net.sourceforge.tuned.ui.TunedUtilities.*;
|
import static net.sourceforge.tuned.ui.TunedUtilities.*;
|
||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
import java.awt.event.MouseAdapter;
|
import java.awt.event.MouseAdapter;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.awt.event.MouseListener;
|
import java.awt.event.MouseListener;
|
||||||
|
@ -38,6 +39,16 @@ import javax.swing.ListModel;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import javax.swing.border.LineBorder;
|
import javax.swing.border.LineBorder;
|
||||||
|
|
||||||
|
import net.miginfocom.swing.MigLayout;
|
||||||
|
import net.sourceforge.filebot.Analytics;
|
||||||
|
import net.sourceforge.filebot.ResourceManager;
|
||||||
|
import net.sourceforge.filebot.subtitle.SubtitleFormat;
|
||||||
|
import net.sourceforge.filebot.ui.subtitle.SubtitlePackage.Download.Phase;
|
||||||
|
import net.sourceforge.filebot.ui.transfer.DefaultTransferHandler;
|
||||||
|
import net.sourceforge.filebot.vfs.MemoryFile;
|
||||||
|
import net.sourceforge.tuned.ExceptionUtilities;
|
||||||
|
import net.sourceforge.tuned.ui.ListView;
|
||||||
|
import net.sourceforge.tuned.ui.TunedUtilities;
|
||||||
import ca.odell.glazedlists.BasicEventList;
|
import ca.odell.glazedlists.BasicEventList;
|
||||||
import ca.odell.glazedlists.EventList;
|
import ca.odell.glazedlists.EventList;
|
||||||
import ca.odell.glazedlists.FilterList;
|
import ca.odell.glazedlists.FilterList;
|
||||||
|
@ -51,17 +62,6 @@ import ca.odell.glazedlists.swing.EventListModel;
|
||||||
import ca.odell.glazedlists.swing.EventSelectionModel;
|
import ca.odell.glazedlists.swing.EventSelectionModel;
|
||||||
import ca.odell.glazedlists.swing.TextComponentMatcherEditor;
|
import ca.odell.glazedlists.swing.TextComponentMatcherEditor;
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
|
||||||
import net.sourceforge.filebot.Analytics;
|
|
||||||
import net.sourceforge.filebot.ResourceManager;
|
|
||||||
import net.sourceforge.filebot.subtitle.SubtitleFormat;
|
|
||||||
import net.sourceforge.filebot.ui.subtitle.SubtitlePackage.Download.Phase;
|
|
||||||
import net.sourceforge.filebot.ui.transfer.DefaultTransferHandler;
|
|
||||||
import net.sourceforge.filebot.vfs.MemoryFile;
|
|
||||||
import net.sourceforge.tuned.ExceptionUtilities;
|
|
||||||
import net.sourceforge.tuned.ui.ListView;
|
|
||||||
import net.sourceforge.tuned.ui.TunedUtilities;
|
|
||||||
|
|
||||||
|
|
||||||
class SubtitleDownloadComponent extends JComponent {
|
class SubtitleDownloadComponent extends JComponent {
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ class SubtitleDownloadComponent extends JComponent {
|
||||||
add(scrollPane, "newline, hmin max(80px, 30%)");
|
add(scrollPane, "newline, hmin max(80px, 30%)");
|
||||||
|
|
||||||
// install fetch action
|
// install fetch action
|
||||||
TunedUtilities.installAction(packageList, KeyStroke.getKeyStroke("ENTER"), new AbstractAction("Fetch") {
|
TunedUtilities.installAction(packageList, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), new AbstractAction("Fetch") {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
@ -142,7 +142,7 @@ class SubtitleDownloadComponent extends JComponent {
|
||||||
});
|
});
|
||||||
|
|
||||||
// install open action
|
// install open action
|
||||||
TunedUtilities.installAction(fileList, KeyStroke.getKeyStroke("ENTER"), new AbstractAction("Open") {
|
TunedUtilities.installAction(fileList, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), new AbstractAction("Open") {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
@ -365,7 +365,6 @@ class SubtitleDownloadComponent extends JComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private final Action clearFilterAction = new AbstractAction(null, ResourceManager.getIcon("edit.clear")) {
|
private final Action clearFilterAction = new AbstractAction(null, ResourceManager.getIcon("edit.clear")) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -141,7 +141,7 @@ public class SubtitleViewer extends JFrame {
|
||||||
});
|
});
|
||||||
|
|
||||||
// focus around selected time stamp
|
// focus around selected time stamp
|
||||||
installAction(table, KeyStroke.getKeyStroke("ENTER"), new AbstractAction("focus") {
|
installAction(table, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), new AbstractAction("focus") {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
@ -245,7 +245,6 @@ public class SubtitleViewer extends JFrame {
|
||||||
return infoLabel;
|
return infoLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private final Action clearFilterAction = new AbstractAction(null, ResourceManager.getIcon("edit.clear")) {
|
private final Action clearFilterAction = new AbstractAction(null, ResourceManager.getIcon("edit.clear")) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -16,6 +16,7 @@ import java.awt.Window;
|
||||||
import java.awt.dnd.DnDConstants;
|
import java.awt.dnd.DnDConstants;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
@ -115,7 +116,7 @@ public final class TunedUtilities {
|
||||||
component.getDocument().addUndoableEditListener(undoSupport);
|
component.getDocument().addUndoableEditListener(undoSupport);
|
||||||
|
|
||||||
// install undo action
|
// install undo action
|
||||||
installAction(component, KeyStroke.getKeyStroke("control Z"), new AbstractAction("Undo") {
|
installAction(component, KeyStroke.getKeyStroke(KeyEvent.VK_Z, KeyEvent.CTRL_MASK), new AbstractAction("Undo") {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
@ -125,7 +126,7 @@ public final class TunedUtilities {
|
||||||
});
|
});
|
||||||
|
|
||||||
// install redo action
|
// install redo action
|
||||||
installAction(component, KeyStroke.getKeyStroke("control Y"), new AbstractAction("Redo") {
|
installAction(component, KeyStroke.getKeyStroke(KeyEvent.VK_Y, KeyEvent.CTRL_MASK), new AbstractAction("Redo") {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
@ -255,8 +256,7 @@ public final class TunedUtilities {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When trying to drag a row of a multi-select JTable, it will start selecting rows instead
|
* When trying to drag a row of a multi-select JTable, it will start selecting rows instead of initiating a drag. This TableUI will give the JTable proper dnd behaviour.
|
||||||
* of initiating a drag. This TableUI will give the JTable proper dnd behaviour.
|
|
||||||
*/
|
*/
|
||||||
public static class DragDropRowTableUI extends BasicTableUI {
|
public static class DragDropRowTableUI extends BasicTableUI {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue