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

49
LINES

< > BotCompany Repo | #1024172 // Quick Annotator with guess field

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Libraryless. Click here for Pure Java version (17662L/125K).

!7

srecord Entry(S text, S annotations, S guess) {
  LS annotations() { ret tok_splitAtComma_emptyOnEmpty(annotations); }
}

/*c*/module QuickAnnotator > DynObjectTable<Entry> {
  start {
    //set withSearcher; // TODO: edits the wrong line on double click
    addCountToName();
  }
  
  afterVisualize {
    tablePopupMenuItemAndDoubleClick(table, "Edit annotations...", voidfunc(int row) {
      Entry e = getRow(row);
      if (e == null) ret;
      JTextField tf = jTextField(e.annotations);
      showFormTitled("Edit annotations",
        "Line", e.text,
        "Annotations (comma-separated)", tf, r {
          e.annotations = gtt(tf);
          fireDataChanged();
        });
    });
  }
  
  IntRange visibleRows() { ret jTable_visibleRows(table); }
  
  // API
  
  void fillData(Collection<PairS> l) {
    setList(map(l, p -> nu Entry(text := p.a, annotations := p.b)));
  }
  
  void fillData(SS map) {
    fillData(mapToPairs(map));
  }
  
  void setItems(Collection<S> l) {
    fillData(map(l, s -> pair(s, "")));
  }
  
  Set<S> allAnnotations() {
    Set<S> set = ciSet();
    for (Entry e : data())
      _addAll(set, e.annotations());
    ret set;
  }
}

Author comment

Began life as a copy of #1024168

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: #1024172
Snippet name: Quick Annotator with guess field
Eternal ID of this version: #1024172/20
Text MD5: e89afded245684a442476afdd7e65fae
Transpilation MD5: a16b4617b1338175afdb96d8e5f723cf
Author: stefan
Category: javax / stefan's os
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-07-24 23:32:18
Source code size: 1223 bytes / 49 lines
Pitched / IR pitched: No / No
Views / Downloads: 287 / 765
Version history: 19 change(s)
Referenced in: [show references]