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

27
LINES

< > BotCompany Repo | #1004682 - showConcepts

JavaX fragment (include)

// see #1004681

static JTable showConcepts() {
  final JTable table = tableWithToolTips();
  showFrame(tableWithSearcher(table));
  
  tablePopupMenu(table, voidfunc(JPopupMenu menu, final int row) {
    menu.add(jmenuitem("Delete", r {
      Map map = getTableLineAsMap(table, row);
      deleteConcept(toInt(map.get("ID")));
    }));
  });
  
  installTimer(table, 1000, 0, new Runnable {
    long changesShown;
    public void run() {
      if (changesShown == changes) ret;
      changesShown = changes;
      L data = map(func(Concept c) {
        litorderedmap("Name", joinLines(" / " , unnull(c.name)), /*"Energy", formatDouble(c.energy, 2),*/ "ID", c.id)
      }, values(concepts));
      dataToTable_uneditable(table, data);
    }
  });
  
  ret table;
}

download  show line numbers  debug dex   

Travelled to 10 computer(s): aoiabmzegqzx, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, tslmcundralx, tvejysmllsmz

No comments. add comment

Snippet ID: #1004682
Snippet name: showConcepts
Eternal ID of this version: #1004682/1
Text MD5: bc83e74d4f07887b5d91089c12f49baf
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-09-02 17:21:04
Source code size: 790 bytes / 27 lines
Pitched / IR pitched: No / No
Views / Downloads: 277 / 216
Referenced in: [show references]