mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-07 12:24:58 +10:00
improve analysis reports
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
*
|
||||
* DIY Layout Creator (DIYLC). Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
*
|
||||
* This file is part of DIYLC.
|
||||
*
|
||||
* DIYLC is free software: you can redistribute it and/or modify it under the terms of the GNU
|
||||
* General Public License as published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* DIYLC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
* Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with DIYLC. If not, see
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package org.diylc.netlist;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class NetlistHtmlReport {
|
||||
|
||||
public static String generateHtml(List<Netlist> netlists, String fontName) {
|
||||
if (netlists == null || netlists.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder("<html><head><style>");
|
||||
sb.append("body { font-family: ").append(fontName)
|
||||
.append(", sans-serif; color: black; margin: 10px; }");
|
||||
sb.append("h2 { font-size: 12px; margin-top: 10px; margin-bottom: 0px; }");
|
||||
sb.append("p { margin: 0; }");
|
||||
sb.append("hr { margin-top: 10px; margin-bottom: 0; }");
|
||||
sb.append(".netlist { font-family: 'Courier New', monospace; font-size: 11px; }");
|
||||
sb.append("</style></head><body>");
|
||||
|
||||
for (Netlist netlist : netlists) {
|
||||
if (netlists.size() > 1) {
|
||||
sb.append("<h2>Switch configuration: ").append(netlist.getSwitchSetup())
|
||||
.append("</h2>");
|
||||
}
|
||||
|
||||
sb.append("<div class=\"netlist\">");
|
||||
sb.append("Connected node groups:<br><br>");
|
||||
for (Group group : netlist.getSortedGroups()) {
|
||||
sb.append(" ").append(group.getSortedNodes()).append("<br>");
|
||||
}
|
||||
sb.append("</div>");
|
||||
|
||||
if (netlists.size() > 1) {
|
||||
sb.append("<br><hr>");
|
||||
}
|
||||
}
|
||||
sb.append("</body></html>");
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,23 @@
|
||||
/*
|
||||
*
|
||||
* DIY Layout Creator (DIYLC). Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
*
|
||||
* This file is part of DIYLC.
|
||||
*
|
||||
* DIYLC is free software: you can redistribute it and/or modify it under the terms of the GNU
|
||||
* General Public License as published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* DIYLC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
* Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with DIYLC. If not, see
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package org.diylc.netlist;
|
||||
|
||||
import org.diylc.netlist.Netlist;
|
||||
import org.diylc.netlist.Summary;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class NetlistSummaryHtmlReport {
|
||||
|
||||
@@ -303,7 +303,7 @@
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>IMPROVEMENT</changeType>
|
||||
<description>Improved the styling of the guitar wiring analysis report</description>
|
||||
<description>Improved the styling of circuit analysis reports</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>BUG_FIX</changeType>
|
||||
|
||||
+4
-18
@@ -10,8 +10,8 @@ import org.diylc.swingframework.TextDialog;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ITask;
|
||||
import org.diylc.netlist.Group;
|
||||
import org.diylc.netlist.Netlist;
|
||||
import org.diylc.netlist.NetlistHtmlReport;
|
||||
import org.diylc.swing.ActionFactory;
|
||||
import org.diylc.swing.ISwingUI;
|
||||
import org.diylc.utils.IconLoader;
|
||||
@@ -62,23 +62,9 @@ public class GenerateNetlistAction extends AbstractAction {
|
||||
ISwingUI.INFORMATION_MESSAGE);
|
||||
return;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder("<html>");
|
||||
|
||||
for (Netlist netlist : res) {
|
||||
sb.append("<p style=\"font-family: " + new JLabel().getFont().getName()
|
||||
+ "; font-size: 9px\">");
|
||||
if (includeSwitches) {
|
||||
sb.append("<b>Switch configuration: ").append(netlist.getSwitchSetup())
|
||||
.append("</b><br><br>");
|
||||
}
|
||||
sb.append("Connected node groups:<br><br>");
|
||||
for (Group v : netlist.getSortedGroups()) {
|
||||
sb.append(" ").append(v.getSortedNodes()).append("<br>");
|
||||
}
|
||||
sb.append("</p><br><hr>");
|
||||
}
|
||||
sb.append("</html>");
|
||||
new TextDialog(swingUI.getOwnerFrame().getRootPane(), sb.toString(), "DIYLC Netlist",
|
||||
|
||||
String html = NetlistHtmlReport.generateHtml(res, new JLabel().getFont().getName());
|
||||
new TextDialog(swingUI.getOwnerFrame().getRootPane(), html, "DIYLC Netlist",
|
||||
new Dimension(800, 600)).setVisible(true);
|
||||
}
|
||||
}, true);
|
||||
|
||||
Reference in New Issue
Block a user