!752 // set these in client static S dbName = "Boolean Flag DB."; static L interpretations = splitAtSpace("ShowWindow HideWindow IsShowing Praise Hello NotForMe Unclear"); static RemoteDB db; static L lines; static JTable table; p-substance { fullRefresh(); L interpretButtons = map(func(final S cname) { jbutton(cname, r { interpret(cname) }) }, interpretations); interpretButtons.add(0, jbutton("Delete", "delete")); tableDependButtons(table, interpretButtons); addToWindow(table, jMinHeight(50, new JScrollPane(jCenteredLine( concatLists( ll((Component) jbutton("Refresh", "fullRefresh")), interpretButtons))))); } svoid fullRefresh { if (db != null) db.close(); db = new RemoteDB(dbName); //db.db.loud = true; refresh(); } svoid refresh { lines = db.xlist("Line"); table = showTable(table, sortedByFieldIgnoreCase("Input", map(func(RC line) { RC intp = db.xgetref(line, "interpretation"); RC guess = db.xgetref(line, "guess"); RC guessedAs = guess == null ? null : db.xgetref(guess, "guessedAs"); ret litorderedmap("Input", db.xS(line, "text"), "Interpretation", intp == null ? "uninterpreted" : db.xclass(intp), "Guess", guessedAs == null ? "" : db.xS(guessedAs, "text")); }, lines))); } static void interpret(S cname) { L line = getSelectedLine(table); if (line == null) ret; S text = (S) line.get(0); print("Interpreting " + quote(text) + " as " + cname); RC ref = (RC) rpc(db.db, "xfindLine", text); RC intp = db.uniq(cname); db.xset(ref, "interpretation", intp); print("Done!"); refresh(); } svoid delete { L line = getSelectedLine(table); if (line == null) ret; S text = (S) line.get(0); print("Deleting line " + quote(text)); RC ref = (RC) rpc(db.db, "xfindLine", text); db.xdelete(ref); print("Done!"); refresh(); }