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)

static JTable dataToTable(O data) {
  ret dataToTable(showTable(), data);
}

static JTable dataToTable(O data, S title) {
  ret dataToTable(showTable(title), data);
}

static JTable dataToTable(JTable table, O data) {
  ret dataToTable(table, data, false);
}

// "now" is ignored now
static JTable dataToTable(JTable table, O data, bool now) {
  new L<L> rows;
  LS cols = new ContentsIndexedList;

  if (data instanceof L) {
    for (O x : (L) data) pcall {
      rows.add(dataToTable_makeRow(x, cols));
    }
  } else if (data instanceof Map) {
    Map map = cast data;
    for (O key : map.keySet()) {
      O value = map.get(key);
      rows.add(litlist(structureOrTextForUser(key), structureOrTextForUser(value)));
    }
  } else if (data != null)
    print("Unknown data type: " + data);

  fillTableWithData(table, rows, cols);
  ret table;
}

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: 834 / 1127
Version history: 7 change(s)
Referenced in: [show references]