abstract sclass DynScoreMatrix extends DynObjectTable { transient JTable tblDetails; transient Map detailsMap; srecord noeq Entry( O candidate, double score, S comment, Map individualScores) {} start { itemToMap = func(Entry e) -> Map { litorderedmap( "Candidate" := e.candidate, "Score" := formatDouble(e.score, 2), "Comment" := nullIfEmpty(e.comment), "Tests performed" := nullIfZero(l(e.individualScores))) }; } O comparator() { ret func(Entry a, Entry b) { cmp(b.score, a.score) }; } void add(Entry a) { syncAddToSortedList(comparator(), data, a); fireDataChanged(); } void setData(Cl l) { super.setData(sorted(l, comparator()); } visualize { JComponent sup = super.visualize(); onTableSelectionChanged(table, r { showDetails(selected()) }); ret jvsplit(sup, detailsSection()); } JComponent detailsSection() { ret jCenteredSection("Details", jscroll(tblDetails = sexyTable())); } void showDetails(Entry e) enter { if (e == null) { detailsMap = null; clearTable(tblDetails); } else dataToTable(tblDetails, map( detailsMap = e.individualScores, (test, score) -> litorderedmap("Test" := strOrNull(test), "Score" := str(score)))); } // API Entry newEntry( O candidate, double score, S comment, Map individualScores) { ret Entry(candidate, score, comment, individualScores); } Entry newEntry( O candidate, double score, Map individualScores) { ret Entry(candidate, score, null, individualScores); } }