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

33
LINES

< > BotCompany Repo | #1001613 // dataToTable (Swing function)

JavaX fragment (include)

1  
static JTable dataToTable(O data) {
2  
  ret dataToTable(showTable(), data);
3  
}
4  
5  
static JTable dataToTable(O data, S title) {
6  
  ret dataToTable(showTable(title), data);
7  
}
8  
9  
static JTable dataToTable(JTable table, O data) {
10  
  ret dataToTable(table, data, false);
11  
}
12  
13  
// "now" is ignored now
14  
static JTable dataToTable(JTable table, O data, bool now) {
15  
  new L<L> rows;
16  
  LS cols = new ContentsIndexedList;
17  
18  
  if (data instanceof L) {
19  
    for (O x : (L) data) pcall {
20  
      rows.add(dataToTable_makeRow(x, cols));
21  
    }
22  
  } else if (data instanceof Map) {
23  
    Map map = cast data;
24  
    for (O key : map.keySet()) {
25  
      O value = map.get(key);
26  
      rows.add(litlist(structureOrTextForUser(key), structureOrTextForUser(value)));
27  
    }
28  
  } else if (data != null)
29  
    print("Unknown data type: " + data);
30  
31  
  fillTableWithData(table, rows, cols);
32  
  ret table;
33  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1001613
Snippet name: dataToTable (Swing function)
Eternal ID of this version: #1001613/8
Text MD5: 119f5e3752af71bc864f7ee086ce0974
Author: stefan
Category: javax swing
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-01 21:10:41
Source code size: 883 bytes / 33 lines
Pitched / IR pitched: No / No
Views / Downloads: 841 / 1135
Version history: 7 change(s)
Referenced in: [show references]