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.

sclass ConceptTable<A extends Concept> {
  JTable table;
  Concepts concepts;
  Class<A> conceptClass;
  Set<S> dropFields;
  IPred<A> filter;
  IF1<L<Map>> postProcess;
  Runnable afterUpdate;
  bool latestFirst;
  int idWidth = 50;
  IF1<A, Map> renderer;
  
  *(Class<A> *conceptClass) {}
  
  JTable getTable() {
    init();
    ret table;
  }
  
  void init {
    if (table != null) ret;
    if (concepts == null) concepts = db_mainConcepts();
    if (renderer == null) renderer = defaultConceptRendererForTable(conceptClass);
    table = sexyTable();
    temp tempSetTL(awtOnConceptChanges_concepts, concepts);
    awtOnConceptChanges(table, 1000, r update);
  }
  
  Cl<A> list() {
    ret main list(concepts, conceptClass);
  }
  
  void update swing {
    new L<Map> data;
    for (A c : list())
      if (filter == null || filter.get(c))
        addIfNotNull(data, (Map) renderer.get(c));
    if (latestFirst) reverseInPlace(data);
    data = (L) postProcess(postProcess, data);
    dataToTable_uneditable(data, table);
    pcallF(afterUpdate);
  }
}

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: 240 / 616
Version history: 6 change(s)
Referenced in: [show references]