1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-23 16:28:51 -05:00

Added MediaInfo tool in Tools panel

This commit is contained in:
Reinhard Pointner 2016-03-11 12:15:10 +00:00
parent bf0cbe41f6
commit 590c667d5e
4 changed files with 50 additions and 10 deletions

View File

@ -12,6 +12,7 @@ import java.util.List;
import javax.swing.BorderFactory;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.TableModel;
@ -31,9 +32,15 @@ class AttributeTool extends Tool<TableModel> {
super("Attributes");
table.setAutoCreateRowSorter(true);
table.setAutoCreateColumnsFromModel(true);
table.setFillsViewportHeight(true);
table.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
table.setBackground(Color.white);
table.setRowHeight(20);
table.setGridColor(new Color(0xEEEEEE));
table.setRowHeight(25);
JScrollPane scrollPane = new JScrollPane(table);
scrollPane.setBorder(BorderFactory.createEmptyBorder());

View File

@ -53,12 +53,16 @@ class ExtractTool extends Tool<TableModel> {
public ExtractTool() {
super("Archives");
table.setFillsViewportHeight(true);
table.setAutoCreateRowSorter(true);
table.setAutoCreateColumnsFromModel(true);
table.setFillsViewportHeight(true);
table.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
table.setRowHeight(20);
table.setBackground(Color.white);
table.setGridColor(new Color(0xEEEEEE));
table.setRowHeight(25);
JScrollPane tableScrollPane = new JScrollPane(table);
tableScrollPane.setBorder(new SeparatorBorder(2, new Color(0, 0, 0, 90), GradientStyle.TOP_TO_BOTTOM, SeparatorBorder.Position.BOTTOM));

View File

@ -1,5 +1,6 @@
package net.filebot.ui.analyze;
import static java.util.Collections.*;
import static net.filebot.Logging.*;
import static net.filebot.MediaTypes.*;
import static net.filebot.util.FileUtilities.*;
@ -14,6 +15,7 @@ import java.util.stream.IntStream;
import javax.swing.BorderFactory;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.TableModel;
@ -31,9 +33,15 @@ class MediaInfoTool extends Tool<TableModel> {
super("MediaInfo");
table.setAutoCreateRowSorter(true);
table.setAutoCreateColumnsFromModel(true);
table.setFillsViewportHeight(true);
table.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
table.setBackground(Color.white);
table.setRowHeight(20);
table.setGridColor(new Color(0xEEEEEE));
table.setRowHeight(25);
JScrollPane scrollPane = new JScrollPane(table);
scrollPane.setBorder(BorderFactory.createEmptyBorder());
@ -69,7 +77,7 @@ class MediaInfoTool extends Tool<TableModel> {
});
}
return new MediaInfoTableModel(files.toArray(new File[0]), data.keySet().toArray(new MediaInfoKey[0]), data.values().toArray(new String[0][]));
return new MediaInfoTableModel(files, data);
}
@Override
@ -122,13 +130,13 @@ class MediaInfoTool extends Tool<TableModel> {
private final String[][] rows;
public MediaInfoTableModel() {
this(new File[0], new MediaInfoKey[0], new String[0][]);
this(emptyList(), emptyMap());
}
public MediaInfoTableModel(File[] files, MediaInfoKey[] keys, String[][] rows) {
this.files = files;
this.keys = keys;
this.rows = rows;
public MediaInfoTableModel(List<File> files, Map<MediaInfoKey, String[]> values) {
this.files = files.toArray(new File[0]);
this.keys = values.keySet().toArray(new MediaInfoKey[0]);
this.rows = values.values().toArray(new String[0][]);
}
@Override
@ -150,6 +158,18 @@ class MediaInfoTool extends Tool<TableModel> {
}
}
@Override
public Class<?> getColumnClass(int column) {
switch (column) {
case 0:
return StreamKind.class;
case 1:
return Integer.class;
default:
return String.class;
}
}
@Override
public int getRowCount() {
return keys.length;

View File

@ -39,6 +39,7 @@ import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.ListSelectionModel;
import javax.swing.RowFilter;
import javax.swing.SwingWorker;
import javax.swing.event.DocumentEvent;
@ -164,6 +165,7 @@ class BindingDialog extends JDialog {
private JTable createBindingTable(TableModel model) {
JTable table = new JTable(model);
table.setAutoCreateRowSorter(true);
table.setAutoCreateColumnsFromModel(true);
table.setFillsViewportHeight(true);
table.setBackground(Color.white);
@ -320,8 +322,15 @@ class BindingDialog extends JDialog {
JTable table = new JTable(new ParameterTableModel(parameters));
table.setAutoCreateRowSorter(true);
table.setAutoCreateColumnsFromModel(true);
table.setFillsViewportHeight(true);
table.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
table.setBackground(Color.white);
table.setGridColor(new Color(0xEEEEEE));
table.setRowHeight(25);
// set media info exclude filter
TableRowSorter<?> sorter = (TableRowSorter<?>) table.getRowSorter();