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;
  new L<S> cols;

  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   

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

No comments. add comment

Snippet ID: #1001613
Snippet name: dataToTable (Swing function)
Eternal ID of this version: #1001613/7
Text MD5: 90c273fb225b1fe71a2941424c053552
Author: stefan
Category: javax swing
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-11-07 00:08:43
Source code size: 863 bytes / 33 lines
Pitched / IR pitched: No / No
Views / Downloads: 634 / 820
Version history: 6 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1001613 & http://1001613.tinybrain.de