|
a/tool/run/plugins/spdx/show.java |
|
b/tool/run/plugins/spdx/show.java |
|
... |
|
... |
19 |
import definitions.Messages;
|
19 |
import definitions.Messages;
|
20 |
import definitions.is;
|
20 |
import definitions.is;
|
21 |
import java.io.File;
|
21 |
import java.io.File;
|
22 |
import www.Table;
|
22 |
import www.Table;
|
23 |
import java.util.ArrayList;
|
23 |
import java.util.ArrayList;
|
|
|
24 |
import main.Graphs;
|
24 |
import script.Plugin;
|
25 |
import script.Plugin;
|
25 |
import spdxlib.tools;
|
26 |
import spdxlib.tools;
|
26 |
import spdxlib.FileInfo;
|
27 |
import spdxlib.FileInfo;
|
27 |
import spdxlib.SPDXfile;
|
28 |
import spdxlib.SPDXfile;
|
28 |
import main.core;
|
29 |
import main.core;
|
|
... |
|
... |
75 |
counterCreators += spdx.creatorSection.people.size();
|
76 |
counterCreators += spdx.creatorSection.people.size();
|
76 |
counterLicensesDeclared += doStatistics(spdx);
|
77 |
counterLicensesDeclared += doStatistics(spdx);
|
77 |
}
|
78 |
}
|
78 |
|
79 |
|
79 |
// calculate percentage of files with a license declared
|
80 |
// calculate percentage of files with a license declared
|
80 |
String percentage =
|
81 |
// String percentage =
|
81 |
" ("
|
82 |
// " ("
|
82 |
+ (counterLicensesDeclared * 100)/counterFiles
|
83 |
// + (counterLicensesDeclared * 100)/counterFiles
|
83 |
+ "% in total)" + html.br;
|
84 |
// + "% in total)" + html.br;
|
84 |
|
85 |
|
85 |
|
86 |
|
86 |
String result =
|
87 |
String summary =
|
87 |
html.div()
|
|
|
88 |
+ "<h2>"
|
88 |
"<h2>"
|
89 |
//+ html.getCommonFolderIcon("wooden-box-label.png")
|
89 |
//+ html.getCommonFolderIcon("wooden-box-label.png")
|
90 |
+ "SPDX documents"
|
90 |
+ "SPDX documents"
|
91 |
+ "</h2>"
|
91 |
+ "</h2>"
|
92 |
+ html._div
|
92 |
+ html._div
|
93 |
+ html.div(20)
|
93 |
+ html.div(20)
|
|
... |
|
... |
95 |
+ core.products.size() + " SPDX documents containing "
|
95 |
+ core.products.size() + " SPDX documents containing "
|
96 |
+ counterFiles + " files in total"
|
96 |
+ counterFiles + " files in total"
|
97 |
+ html.br
|
97 |
+ html.br
|
98 |
//+ html.getCommonFolderIcon("calculator.png")
|
98 |
//+ html.getCommonFolderIcon("calculator.png")
|
99 |
+ counterLicensesDeclared + " files with declared licenses"
|
99 |
+ counterLicensesDeclared + " files with declared licenses"
|
100 |
+ percentage
|
100 |
//+ percentage
|
101 |
//+ html.getCommonFolderIcon("stickman.png")
|
101 |
//+ html.getCommonFolderIcon("stickman.png")
|
102 |
+ counterCreators + " SPDX creators" + html.br
|
102 |
+ counterCreators + " SPDX creators" + html.br
|
103 |
+ html.br
|
103 |
+ html.br
|
|
|
104 |
;
|
|
|
105 |
|
|
|
106 |
// generate the nice graph
|
|
|
107 |
String[] titles = new String[]{"No license declared", "License declared"};
|
|
|
108 |
int noLicenses = counterFiles - counterLicensesDeclared;
|
|
|
109 |
int[] values = new int[]{noLicenses, counterLicensesDeclared};
|
|
|
110 |
// do the graph file
|
|
|
111 |
File graphFile = Graphs.generate(thisFolder, titles, values);
|
|
|
112 |
|
|
|
113 |
String[] header = new String[]{summary,
|
|
|
114 |
html.br
|
|
|
115 |
+ html.getIcon("chart.png", request)};
|
|
|
116 |
values = new int[]{270, 200};
|
|
|
117 |
|
|
|
118 |
summary = Table.alignedTable(header, values);
|
|
|
119 |
|
|
|
120 |
String result =
|
|
|
121 |
html.div(20)
|
|
|
122 |
+ summary
|
104 |
+ listFilesSPDX(request)
|
123 |
+ listFilesSPDX(request)
|
105 |
//+ html.br
|
124 |
//+ html.br
|
106 |
+ html._div
|
125 |
+ html._div
|
107 |
+ html.br
|
126 |
+ html.br
|
108 |
+ "";
|
127 |
+ "";
|
|
... |
|
... |
169 |
String fileLink = html.link(file.getName(),
|
188 |
String fileLink = html.link(file.getName(),
|
170 |
"?x=summary&spdx="
|
189 |
"?x=summary&spdx="
|
171 |
+ filteredPath
|
190 |
+ filteredPath
|
172 |
+ "");
|
191 |
+ "");
|
173 |
|
192 |
|
174 |
System.err.println("MSG SH23 - " + fileLink);
|
193 |
//System.err.println("MSG SH23 - " + fileLink);
|
175 |
|
194 |
|
176 |
result += Table.alignedTable(new String[]{
|
195 |
result += Table.alignedTable(new String[]{
|
177 |
html.getIcon("document-text.png", request),
|
196 |
html.getIcon("document-text.png", request),
|
178 |
fileLink},
|
197 |
fileLink},
|
179 |
sizes);
|
198 |
sizes);
|