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

35
LINES

< > BotCompany Repo | #1007112 // Backup of dataToTable before addition of images

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);
  }
  
  static JTable dataToTable(JTable table, O data, bool now) {
    new L<L<S>> 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(structureOrText(key), structureOrText(value)));
      }
    } else
      print("Unknown data type: " + data);

    if (now)
      table.setModel(fillTableWithStrings_makeModel(rows, toStringArray(cols)));
    else
      fillTableWithStrings(table, rows, cols);
    ret table;
  }

Author comment

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: 425 / 448
Version history: 1 change(s)
Referenced in: