Uses 911K of libraries. Click here for Pure Java version (10190L/55K).
1 | !7 |
2 | |
3 | concept Statement { |
4 | S globalID = aGlobalIDUnlessLoading(); |
5 | S text; |
6 | S comments; |
7 | long discordUserID; |
8 | S context; |
9 | } |
10 | |
11 | cmodule Statements > DynCRUD<Statement> { |
12 | enhanceFrame { internalFrameIcon(f, gazelle_frameIcon()); } |
13 | |
14 | start { |
15 | dbIndexing(Statement, 'globalID); |
16 | |
17 | crud.multiLineFields = litset('text, 'comments); |
18 | crud.dontDuplicateFields = litset('globalID); |
19 | crud.renderer = func(Statement r) -> Map { litorderedmap("Statement ID" := r.globalID, text := joinWithSpace(tlft(r.text)), comments := escapeNewLines(r.comments)) }; |
20 | onConceptsChange(r { vmBus_sendMessage('gazelleStatementsChanged, this) }); |
21 | } |
22 | |
23 | // API |
24 | |
25 | Pair<S, Bool> addStatement(S text) { |
26 | ret addStatementWithComment(text, null); |
27 | } |
28 | |
29 | Pair<S, Bool> addStatementWithComment(S text, S comment) { |
30 | Pair<Statement, Bool> p = uniq2_sync(Statement, |
31 | text := rtrim(text), |
32 | comments := nullIfEmpty(rtrim(comment))); |
33 | if (p.b) vmBus_sendMessage('gazelleStatementCreated, this, p.a); |
34 | ret pair(p.a.globalID, p.b); |
35 | } |
36 | |
37 | PairS textAndCommentForStatement(S statementID) { |
38 | Statement r = conceptWhere Statement(globalID := statementID); |
39 | ret r == null ? null : pair(r.text, r.comments); |
40 | } |
41 | } |
Began life as a copy of #1021352
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1021740 |
Snippet name: | Gazelle: Statements [Dyn Module] |
Eternal ID of this version: | #1021740/3 |
Text MD5: | 06e68d05959b1dc4c373a4aa1b46993c |
Transpilation MD5: | 626d23c247315176eb6714a84d265548 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-02-25 17:02:11 |
Source code size: | 1265 bytes / 41 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 310 / 4304 |
Version history: | 2 change(s) |
Referenced in: | [show references] |