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 | static JTable dataToTable(JTable table, O data, bool now) { |
14 | new L<L<S>> rows; |
15 | new L<S> cols; |
16 | |
17 | if (data instanceof L) { |
18 | for (O x : (L) data) pcall { |
19 | rows.add(dataToTable_makeRow(x, cols)); |
20 | } |
21 | } else if (data instanceof Map) { |
22 | Map map = cast data; |
23 | for (O key : map.keySet()) { |
24 | O value = map.get(key); |
25 | rows.add(litlist(structureOrText(key), structureOrText(value))); |
26 | } |
27 | } else |
28 | print("Unknown data type: " + data); |
29 | |
30 | if (now) |
31 | table.setModel(fillTableWithStrings_makeModel(rows, toStringArray(cols))); |
32 | else |
33 | fillTableWithStrings(table, rows, cols); |
34 | ret table; |
35 | } |
Began life as a copy of #1001613
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1007112 |
Snippet name: | Backup of dataToTable before addition of images |
Eternal ID of this version: | #1007112/2 |
Text MD5: | aed28bc8cf31682963cab39042e2257e |
Author: | stefan |
Category: | javax swing |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-03-04 15:49:20 |
Source code size: | 980 bytes / 35 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 424 / 447 |
Version history: | 1 change(s) |
Referenced in: | [show references] |