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


< > BotCompany Repo | #1001984 - dataToTable_makeRow

JavaX fragment (include)

static void dataToTable_dynSet(L l, int i, O s) {
  while (i >= l.size()) l.add("");
  l.set(i, s);

static L dataToTable_makeRow(O x, L<S> cols) {
  if (instanceOf(x, "DynamicObject"))
    x = get_raw(x, "fieldValues");

  if (x instanceof Map) {
    Map m = cast x;
    new L row;
    for (O _field : keysWithoutHidden(m)) {
      S field = cast _field;
      O value = m.get(field);
      int col = cols.indexOf(field);
      if (col < 0) {
        col = cols.size()-1;
      dataToTable_dynSet(row, col, dataToTable_wrapValue(value));
    ret row;
  // XXX new
  if (x cast L)
    ret allToString(x);
  ret litlist(structureOrText(x));

static O dataToTable_wrapValue(O o) {
  if (o instanceof BufferedImage) ret o;
  if (o cast MakesBufferedImage) ret o.getBufferedImage();
  ifclass RGBImage
    if (o instanceof RGBImage) ret o; // huh?
  if (o instanceof Bool) ret o;
  ret structureOrTextForUser(o);

Author comment

Began life as a copy of #1001613

download  show line numbers  debug dex   

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

No comments. add comment

Snippet ID: #1001984
Snippet name: dataToTable_makeRow
Eternal ID of this version: #1001984/7
Text MD5: 50e9574f48ca1a693af3b0307012807b
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-08-03 12:49:12
Source code size: 1013 bytes / 41 lines
Pitched / IR pitched: No / No
Views / Downloads: 563 / 1066
Version history: 6 change(s)
Referenced in: [show references]

Formerly at &