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

46
LINES

< > BotCompany Repo | #1020906 // Mech Lists Selector

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

Libraryless. Click here for Pure Java version (12886L/91K).

!7

sclass Entry {
  S listName;
  bool selected;
  
  *() {}
  *(S *listName) {}
}

module MechListsSelector > DynObjectTable<Entry> {
  transient JTextArea taDetail;
  
  start {
    dm_useLocalMechListCopies();
    set withSearcher;
  }
  
  visualize {
    if (empty(data))
      addLists(mechListNames()); // TODO: update later
    JComponent c = super.visualize();
    onTableSelectionChanged(table(), r {
      if (selected() == null) clearTextAndDisable(taDetail);
      else setTextAndEnable(taDetail, mL_raw(selected().listName));
    });
    onTableCellLeftClick(table(), voidfunc(int col, int row) {
      if (tableColumnNameIs(table(), col, "Selected")) {
        data.get(row).selected = !data.get(row).selected;
        fireDataChanged();
      }
    });
    ret jhsplit(c, taDetail = wordWrapTypeWriterTextArea(), 0.3);
  }
  
  // API

  void addLists(Collection<S> names) {
    L<Entry> l = cloneList(data);
    Map<S, Entry> index = indexByFieldCI name(l);
    for (S name : unnull(names))
      if (!index.containsKey(name))
        l.add(Entry(name));
    setData(sortedByFieldIC name(l));
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1020906
Snippet name: Mech Lists Selector
Eternal ID of this version: #1020906/10
Text MD5: 071c426be9ab9958fb8dad73dfa9d0b1
Transpilation MD5: e65f287100a361d181dc95e2100f2590
Author: stefan
Category: javax / concepts
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-01-19 15:38:38
Source code size: 1161 bytes / 46 lines
Pitched / IR pitched: No / No
Views / Downloads: 238 / 1254
Version history: 9 change(s)
Referenced in: [show references]