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

* highlight verification cells (green foreground)

* increase max-heap-size in jnlp descriptor
This commit is contained in:
Reinhard Pointner 2009-08-10 16:20:18 +00:00
parent e58947e6a4
commit 3d9839a73f
7 changed files with 55 additions and 14 deletions

View File

@ -29,7 +29,7 @@
<resources> <resources>
<property name="jnlp.packEnabled" value="true" /> <property name="jnlp.packEnabled" value="true" />
<java version="1.6+" /> <java version="1.6+" max-heap-size="256m" />
<jar href="filebot.jar" main="true" /> <jar href="filebot.jar" main="true" />
<extension name="lib" href="filebot.lib.jnlp" /> <extension name="lib" href="filebot.lib.jnlp" />
</resources> </resources>

View File

@ -36,7 +36,7 @@
<resources> <resources>
<property name="jnlp.packEnabled" value="true" /> <property name="jnlp.packEnabled" value="true" />
<java version="1.6+" /> <java version="1.6+" max-heap-size="256m" />
<jar href="filebot.jar" main="true" /> <jar href="filebot.jar" main="true" />
<extension name="lib" href="filebot.lib.jnlp" /> <extension name="lib" href="filebot.lib.jnlp" />
</resources> </resources>

View File

@ -21,6 +21,8 @@ public class ChecksumCellRenderer extends DefaultTableCellRenderer {
private final SwingWorkerCellRenderer progressRenderer = new SwingWorkerCellRenderer(); private final SwingWorkerCellRenderer progressRenderer = new SwingWorkerCellRenderer();
private final Color verificationForeground = new Color(0x009900);
@Override @Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
@ -41,7 +43,7 @@ public class ChecksumCellRenderer extends DefaultTableCellRenderer {
// if row state is ERROR and if we are not selected use text color RED, // if row state is ERROR and if we are not selected use text color RED,
// else use default table colors // else use default table colors
setForeground(isSelected ? table.getSelectionForeground() : isError ? Color.RED : table.getForeground()); setForeground(isSelected ? table.getSelectionForeground() : isError ? Color.RED : isVerificationColumn(table, column) ? verificationForeground : table.getForeground());
setBackground(isSelected ? table.getSelectionBackground() : table.getBackground()); setBackground(isSelected ? table.getSelectionBackground() : table.getBackground());
// use BOLD font on ERROR // use BOLD font on ERROR
@ -59,4 +61,13 @@ public class ChecksumCellRenderer extends DefaultTableCellRenderer {
return this; return this;
} }
private boolean isVerificationColumn(JTable table, int column) {
ChecksumTableModel model = (ChecksumTableModel) table.getModel();
int modelColumn = table.getColumnModel().getColumn(column).getModelIndex();
return model.isVerificationColumn(modelColumn);
}
} }

View File

@ -5,11 +5,12 @@ package net.sourceforge.filebot.ui.panel.sfv;
import static net.sourceforge.filebot.hash.VerificationUtilities.*; import static net.sourceforge.filebot.hash.VerificationUtilities.*;
import java.awt.Color; import java.awt.Color;
import java.awt.event.MouseEvent;
import javax.swing.JTable; import javax.swing.JTable;
import javax.swing.ListSelectionModel; import javax.swing.ListSelectionModel;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableColumn; import javax.swing.table.TableColumn;
import javax.swing.table.TableModel;
import net.sourceforge.tuned.ui.TunedUtilities.DragDropRowTableUI; import net.sourceforge.tuned.ui.TunedUtilities.DragDropRowTableUI;
@ -40,11 +41,32 @@ class ChecksumTable extends JTable {
@Override @Override
protected TableModel createDefaultDataModel() { protected ChecksumTableModel createDefaultDataModel() {
return new ChecksumTableModel(); return new ChecksumTableModel();
} }
@Override
protected JTableHeader createDefaultTableHeader() {
return new JTableHeader(columnModel) {
@Override
public String getToolTipText(MouseEvent evt) {
try {
int columnIndex = columnModel.getColumnIndexAtX(evt.getX());
int modelIndex = columnModel.getColumn(columnIndex).getModelIndex();
// display column root of checksum column
return getModel().getColumnRoot(modelIndex).getPath();
} catch (Exception e) {
// ignore, column is not a checksum column
return null;
}
};
};
}
@Override @Override
public ChecksumTableModel getModel() { public ChecksumTableModel getModel() {
return (ChecksumTableModel) super.getModel(); return (ChecksumTableModel) super.getModel();

View File

@ -44,7 +44,7 @@ class ChecksumTableExportHandler extends TextFileExportHandler {
protected File defaultColumn() { protected File defaultColumn() {
// select first column that is not a verification file column // select first column that is not a verification file column
for (File root : model.checksumColumns()) { for (File root : model.getChecksumColumns()) {
if (root.isDirectory()) if (root.isDirectory())
return root; return root;
} }

View File

@ -19,6 +19,7 @@ import java.util.Set;
import javax.swing.table.AbstractTableModel; import javax.swing.table.AbstractTableModel;
import net.sourceforge.filebot.hash.HashType; import net.sourceforge.filebot.hash.HashType;
import net.sourceforge.tuned.FastFile;
import net.sourceforge.tuned.FileUtilities; import net.sourceforge.tuned.FileUtilities;
@ -76,13 +77,18 @@ class ChecksumTableModel extends AbstractTableModel {
} }
protected File getColumnRoot(int columnIndex) { public File getColumnRoot(int columnIndex) {
// substract checksum column offset // substract checksum column offset
return checksumColumns.get(columnIndex - 2); return checksumColumns.get(columnIndex - 2);
} }
public List<File> checksumColumns() { public boolean isVerificationColumn(int columnIndex) {
return columnIndex >= 2 && getColumnRoot(columnIndex).isFile();
}
public List<File> getChecksumColumns() {
return Collections.unmodifiableList(checksumColumns); return Collections.unmodifiableList(checksumColumns);
} }
@ -195,7 +201,7 @@ class ChecksumTableModel extends AbstractTableModel {
cell.addPropertyChangeListener(progressListener); cell.addPropertyChangeListener(progressListener);
if (!checksumColumns.contains(cell.getRoot())) { if (!checksumColumns.contains(cell.getRoot())) {
checksumColumns.add(cell.getRoot()); checksumColumns.add(new FastFile(cell.getRoot().getPath()));
} }
} }
@ -242,6 +248,7 @@ class ChecksumTableModel extends AbstractTableModel {
fireTableStructureChanged(); fireTableStructureChanged();
} }
private final PropertyChangeListener stateListener = new PropertyChangeListener() { private final PropertyChangeListener stateListener = new PropertyChangeListener() {
@Override @Override
@ -344,6 +351,7 @@ class ChecksumTableModel extends AbstractTableModel {
} }
private final PropertyChangeSupport pcs = new PropertyChangeSupport(this); private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);

View File

@ -257,7 +257,7 @@ public class SfvPanel extends JComponent {
List<File> options = new ArrayList<File>(); List<File> options = new ArrayList<File>();
// filter out verification file columns // filter out verification file columns
for (File file : table.getModel().checksumColumns()) { for (File file : table.getModel().getChecksumColumns()) {
if (file.isDirectory()) if (file.isDirectory())
options.add(file); options.add(file);
} }