Warning: session_start(): open(/var/lib/php/sessions/sess_bfu1iaiujd5lj909mpp85bd853, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
// optional parameters
static ThreadLocal> showConceptsTable_dropFields = new ThreadLocal;
static new ThreadLocal showConceptsTable_postProcess; // func(L) -> L
static new ThreadLocal showConceptsTable_afterUpdate; // voidfunc(JTable)
static new ThreadLocal showConceptsTable_concepts;
static new ThreadLocal showConceptsTable_latestFirst;
static int makeConceptsTable_idWidth = 50;
static JTable showConceptsTable(Class extends Concept> c) {
JTable table = makeConceptsTable(c);
showFrame(plural(shortClassName(c)), table);
ret table;
}
static JTable makeConceptsTable(final Class extends Concept> c) {
L dropFields = getAndClearThreadLocal(showConceptsTable_dropFields);
fO pp = getAndClearThreadLocal(showConceptsTable_postProcess);
fO afterUpdate = optParam(showConceptsTable_afterUpdate);
final Concepts concepts = optParam(showConceptsTable_concepts, db_mainConcepts());
fbool latestFirst = boolParam(showConceptsTable_latestFirst);
final L fields = listMinusList(concatLists(ll("id"), conceptFieldsInOrder(c)), dropFields);
final JTable table = sexyTable();
tablePopupMenu(table, voidfunc(JPopupMenu menu, final int row) {
addMenuItem(menu, "Delete", r {
final long id = toLong(getTableCell(table, row, 0));
withDBLock(r { deleteConcept(concepts, id) });
});
});
temp tempSetTL(awtOnConceptChanges_concepts, concepts);
awtOnConceptChanges(table, r {
//print("Updating concept table");
new L data;
for (final Concept cc : list(concepts, c))
data.add(map(func(S field) { renderForTable(cget(cc, field)) }, fields));
if (latestFirst) reverseInPlace(data);
data = (L) postProcess(pp, data);
fillTableWithData(table, data, map humanizeFormLabel(fields));
if (table.getColumnCount() > 0)
table.getColumnModel().getColumn(0).setMaxWidth(makeConceptsTable_idWidth);
pcallF(afterUpdate, table);
}, true);
ret table;
}
// renderer takes a concept and makes a map for display
static JTable makeConceptsTable(final Class cClass, final O renderer) {
if (renderer == null) ret makeConceptsTable(cClass);
fO pp = optParam(showConceptsTable_postProcess);
fO afterUpdate = optParam(showConceptsTable_afterUpdate);
final Concepts concepts = optParam(showConceptsTable_concepts);
final JTable table = sexyTable();
temp tempSetTL(awtOnConceptChanges_concepts, concepts);
awtOnConceptChanges(table, 1000, r {
new L