Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

43
LINES

< > BotCompany Repo | #1026279 // ConceptTable - better class-based version of showConceptsTable/makeConceptsTable. Probably JConceptsTable is even better

JavaX fragment (include) [tags: use-pretranspiled]

Transpiled version (16054L) is out of date.

1  
sclass ConceptTable<A extends Concept> {
2  
  JTable table;
3  
  Concepts concepts;
4  
  Class<A> conceptClass;
5  
  Set<S> dropFields;
6  
  IPred<A> filter;
7  
  IF1<L<Map>> postProcess;
8  
  Runnable afterUpdate;
9  
  bool latestFirst;
10  
  int idWidth = 50;
11  
  IF1<A, Map> renderer;
12  
  
13  
  *(Class<A> *conceptClass) {}
14  
  
15  
  JTable getTable() {
16  
    init();
17  
    ret table;
18  
  }
19  
  
20  
  void init {
21  
    if (table != null) ret;
22  
    if (concepts == null) concepts = db_mainConcepts();
23  
    if (renderer == null) renderer = defaultConceptRendererForTable(conceptClass);
24  
    table = sexyTable();
25  
    temp tempSetTL(awtOnConceptChanges_concepts, concepts);
26  
    awtOnConceptChanges(table, 1000, r update);
27  
  }
28  
  
29  
  Cl<A> list() {
30  
    ret main list(concepts, conceptClass);
31  
  }
32  
  
33  
  void update swing {
34  
    new L<Map> data;
35  
    for (A c : list())
36  
      if (filter == null || filter.get(c))
37  
        addIfNotNull(data, (Map) renderer.get(c));
38  
    if (latestFirst) reverseInPlace(data);
39  
    data = (L) postProcess(postProcess, data);
40  
    dataToTable_uneditable(data, table);
41  
    pcallF(afterUpdate);
42  
  }
43  
}

Author comment

Began life as a copy of #1006009

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1026279
Snippet name: ConceptTable - better class-based version of showConceptsTable/makeConceptsTable. Probably JConceptsTable is even better
Eternal ID of this version: #1026279/7
Text MD5: 0aa488256758e2242f6119b1c01afa59
Author: stefan
Category: javax / gui / concepts
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-03-31 15:12:03
Source code size: 1102 bytes / 43 lines
Pitched / IR pitched: No / No
Views / Downloads: 242 / 619
Version history: 6 change(s)
Referenced in: [show references]