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

31
LINES

< > BotCompany Repo | #1017625 // fillTableWithData_makeData

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (7105L/42K).

1  
static Pair<O[][], O[]> fillTableWithData_makeData(L<L> rows, LS colNames) {
2  
  ret fillTableWithData_makeData(rows, asStringArray(colNames));
3  
}
4  
5  
static Pair<O[][], O[]> fillTableWithData_makeData(L<L> rows, S... colNames) {
6  
  Object[][] data = new Object[rows.size()][];
7  
  int w = 0;
8  
  for (int i = 0; i < rows.size(); i++) {
9  
    L l = rows.get(i);
10  
    Object[] r = new Object[l.size()];
11  
    for (int j = 0; j < l.size(); j++) {
12  
      O o = l.get(j);
13  
      
14  
      //print ifdef fillTableWithData_makeData_debug("fillTable " + getClass(o));
15  
      
16  
      if (o cast BufferedImage) o = imageIcon(o);
17  
      ifclass RGBImage
18  
        if (o cast RGBImage) o = imageIcon(o);
19  
      endif
20  
      /*if (o cast File)
21  
        o = f2s(o);*/
22  
      r[j] = o;
23  
    }
24  
    data[i] = r;
25  
    w = Math.max(w, l.size());
26  
  }
27  
  O[] columnNames = new O[w];
28  
  for (int i = 0; i < w; i++)
29  
    columnNames[i] = i < l(colNames) ? colNames[i] : "?";
30  
  ret pair(data, columnNames);
31  
}

Author comment

Began life as a copy of #1004995

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: #1017625
Snippet name: fillTableWithData_makeData
Eternal ID of this version: #1017625/6
Text MD5: 6117e53ce23da159ed2798605ed8dfda
Transpilation MD5: 007579ec47b9b3d31b5c8204ad5adde2
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-10 16:18:18
Source code size: 982 bytes / 31 lines
Pitched / IR pitched: No / No
Views / Downloads: 365 / 441
Version history: 5 change(s)
Referenced in: [show references]