List all disks

This commit is contained in:
Denis Molony 2016-12-09 23:12:35 +11:00
parent cfdb5fcd5c
commit 21419474d1
2 changed files with 19 additions and 28 deletions

View File

@ -8,7 +8,7 @@ import javax.swing.table.AbstractTableModel;
public class DiskTableModel extends AbstractTableModel
{
static final String[] headers = { "Disk name", "Actual disk", "Checksum" };
static final String[] headers = { "Name", "Location", "Checksum" };
Map<String, DiskDetails> fileNameMap;
Map<Long, DiskDetails> checkSumMap;
@ -23,31 +23,17 @@ public class DiskTableModel extends AbstractTableModel
{
DiskDetails original = fileNameMap.get (key);
if (false)
{
if (original.getDuplicateNames ().size () > 0)
{
lines.add (new TableLine (original));
for (DiskDetails duplicate : original.getDuplicateNames ())
lines.add (new TableLine (duplicate));
}
}
else
{
if (original.getDuplicateChecksums ().size () > 0)
{
lines.add (new TableLine (original));
for (DiskDetails duplicate : original.getDuplicateChecksums ())
lines.add (new TableLine (duplicate));
}
// else if (original.isDuplicateChecksum ())
// {
// lines.add (new TableLine (key, original));
// DiskDetails dd = checkSumMap.get (original.getChecksum ());
// for (DiskDetails duplicate : dd.getDuplicateChecksums ())
// lines.add (new TableLine (key, duplicate));
// }
}
// if (false)
// {
// if (original.getDuplicateChecksums ().size () > 0)
// {
// lines.add (new TableLine (original));
// for (DiskDetails duplicate : original.getDuplicateChecksums ())
// lines.add (new TableLine (duplicate));
// }
// }
// else
lines.add (new TableLine (original));
}
}

View File

@ -9,6 +9,7 @@ import java.util.List;
import java.util.Map;
import javax.swing.*;
import javax.swing.table.JTableHeader;
public class DuplicateWindow extends JFrame
{
@ -138,7 +139,7 @@ public class DuplicateWindow extends JFrame
}
});
setSize (900, 700);
setSize (1100, 700);
setLocationRelativeTo (null);
setDefaultCloseOperation (HIDE_ON_CLOSE);
}
@ -147,9 +148,13 @@ public class DuplicateWindow extends JFrame
{
this.duplicateHandler = duplicateHandler;
table.setModel (new DiskTableModel (duplicateHandler));
table.getColumnModel ().getColumn (0).setPreferredWidth (250);
table.getColumnModel ().getColumn (0).setPreferredWidth (300);
table.getColumnModel ().getColumn (1).setPreferredWidth (500);
table.getColumnModel ().getColumn (2).setPreferredWidth (100);
JTableHeader header = table.getTableHeader ();
header.setFont (header.getFont ().deriveFont ((float) 13.0));
setVisible (true);
}
}