Skip to content

Commit 5f0604f

Browse files
Removed duplicate popup container div
Removed duplicate popup container div
1 parent b506ac1 commit 5f0604f

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

report/src/main/java/org/hjug/refactorfirst/report/HtmlReport.java

+18-15
Original file line numberDiff line numberDiff line change
@@ -506,8 +506,8 @@ public String renderClassGraphDotImage() {
506506
stringBuilder.append("const " + classGraphName + "_dot = " + dot + "\n");
507507
stringBuilder.append("</script>\n");
508508
stringBuilder.append(generateForce3DPopup(classGraphName));
509-
510509
stringBuilder.append(generate2DPopup(classGraphName));
510+
stringBuilder.append(generateHidePopup(classGraphName));
511511

512512
stringBuilder.append("<div align=\"center\">\nRed lines represent back edges to remove.<br>\n");
513513
stringBuilder.append("Zoom in / out with your mouse wheel and click/move to drag the image.\n");
@@ -525,6 +525,9 @@ public String renderClassGraphDotImage() {
525525
stringBuilder.append(".fit(true)\n");
526526
stringBuilder.append(".renderDot(" + classGraphName + "_dot);\n");
527527
stringBuilder.append("</script>\n");
528+
} else {
529+
// revisit and add D3 SVG popup button
530+
stringBuilder.append("<div align=\"center\">\nMap is too big to render SVG quickly</div>\n");
528531
}
529532

530533
return stringBuilder.toString();
@@ -591,6 +594,7 @@ public String renderCycleDotImage(RankedCycle cycle) {
591594
stringBuilder.append("</script>\n");
592595
stringBuilder.append(generateForce3DPopup(cycleName));
593596
stringBuilder.append(generate2DPopup(cycleName));
597+
stringBuilder.append(generateHidePopup(cycleName));
594598

595599
stringBuilder.append("<div align=\"center\">\n");
596600
stringBuilder.append("Red lines represent back edges to remove.<br>\n");
@@ -609,8 +613,8 @@ public String renderCycleDotImage(RankedCycle cycle) {
609613
stringBuilder.append(".renderDot(" + cycleName + "_dot);\n");
610614
stringBuilder.append("</script>\n");
611615
} else {
612-
// revisit and add D3 popup button as well
613-
616+
// revisit and add D3 SVG popup button
617+
stringBuilder.append("<div align=\"center\">\nCycle is too big to render SVG quickly</div>\n");
614618
}
615619

616620
stringBuilder.append("<br/>\n");
@@ -672,22 +676,21 @@ String buildCycleDot(Graph<String, DefaultWeightedEdge> classGraph, RankedCycle
672676
String generate2DPopup(String cycleName) {
673677
// Created by generative AI and modified
674678
return "<button style=\"display: block; margin: 0 auto;\" onclick=\"showPopup('popup-" + cycleName
675-
+ "', 'graph-container-" + cycleName + "'," + cycleName + "_dot )\">Show " + cycleName
676-
+ " 2D Popup</button>\n" + "\n"
677-
+ "<div class=\"popup\" id=\"popup-"
678-
+ cycleName + "\">\n" + " <span class=\"close-btn\" onclick=\"hidePopup()\">×</span>\n"
679-
+ " <div id=\"graph-container-"
680-
+ cycleName + "\" style=\"width: 100%; height: 100%;\"></div>\n" + "</div>";
679+
+ "', 'graph-container-" + cycleName + "', " + cycleName + "_dot )\">Show " + cycleName
680+
+ " 2D Popup</button>\n";
681681
}
682682

683683
String generateForce3DPopup(String cycleName) {
684684
// Created by generative AI and modified
685685
return "<button style=\"display: block; margin: 0 auto;\" onclick=\"createForceGraph('popup-" + cycleName
686-
+ "', 'graph-container-" + cycleName + "'," + cycleName + "_dot )\">Show " + cycleName
687-
+ " 3D Popup</button>\n" + "\n"
688-
+ "<div class=\"popup\" id=\"popup-"
689-
+ cycleName + "\">\n" + " <span class=\"close-btn\" onclick=\"hidePopup()\">×</span>\n"
690-
+ " <div id=\"graph-container-"
691-
+ cycleName + "\" style=\"width: 100%; height: 100%;\"></div>\n" + "</div>";
686+
+ "', 'graph-container-" + cycleName + "', " + cycleName + "_dot )\">Show " + cycleName
687+
+ " 3D Popup</button>\n";
688+
}
689+
690+
String generateHidePopup(String cycleName) {
691+
return "<div class=\"popup\" id=\"popup-" + cycleName + "\">\n"
692+
+ "<span class=\"close-btn\" onclick=\"hidePopup()\">×</span>\n"
693+
+ " <div id=\"graph-container-" + cycleName + "\" style=\"width: 100%; height: 100%;\"></div>"
694+
+ "\n</div>\n";
692695
}
693696
}

0 commit comments

Comments
 (0)