use of ini.trakem2.persistence.FSLoader in project TrakEM2 by trakem2.
the class Merger method makeGUI.
private static void makeGUI(final Project p1, final Project p2, HashSet<ZDisplayable> empty1, HashSet<ZDisplayable> empty2, HashMap<Displayable, List<Change>> matched, HashSet<ZDisplayable> unmatched1, HashSet<ZDisplayable> unmatched2) {
final ArrayList<Row> rows = new ArrayList<Row>();
for (Map.Entry<Displayable, List<Change>> e : matched.entrySet()) {
for (Change c : e.getValue()) {
rows.add(new Row(c));
}
if (e.getValue().size() > 1) {
Utils.log("More than one assigned to " + e.getKey());
}
}
JTabbedPane tabs = new JTabbedPane();
final Table table = new Table();
tabs.addTab("Matched", new JScrollPane(table));
JTable tu1 = createTable(unmatched1, "Unmatched 1", p1, p2);
JTable tu2 = createTable(unmatched2, "Unmatched 2", p1, p2);
JTable tu3 = createTable(empty1, "Empty 1", p1, p2);
JTable tu4 = createTable(empty2, "Empty 2", p1, p2);
tabs.addTab("Unmatched 1", new JScrollPane(tu1));
tabs.addTab("Unmatched 2", new JScrollPane(tu2));
tabs.addTab("Empty 1", new JScrollPane(tu3));
tabs.addTab("Empty 2", new JScrollPane(tu4));
for (int i = 0; i < tabs.getTabCount(); i++) {
if (null == tabs.getTabComponentAt(i)) {
Utils.log2("null at " + i);
continue;
}
tabs.getTabComponentAt(i).setPreferredSize(new Dimension(1024, 768));
}
String xml1 = new File(((FSLoader) p1.getLoader()).getProjectXMLPath()).getName();
String xml2 = new File(((FSLoader) p2.getLoader()).getProjectXMLPath()).getName();
JFrame frame = new JFrame("1: " + xml1 + " || 2: " + xml2);
tabs.setPreferredSize(new Dimension(1024, 768));
frame.getContentPane().add(tabs);
frame.pack();
frame.setVisible(true);
// so the bullshit starts: any other way to set the model fails, because it tries to render it while setting it
SwingUtilities.invokeLater(new Runnable() {
public void run() {
table.setModel(new Model(rows));
CustomCellRenderer cc = new CustomCellRenderer();
for (int i = 0; i < Row.COLUMNS; i++) {
table.setDefaultRenderer(table.getColumnClass(i), cc);
}
}
});
}
Aggregations