47 return EnumSet.of(MODULE);
48 }
49
50 @Override
51 public boolean isInlineTag() {
52 return false;
53 }
54
55 @Override
56 public String getName() {
57 return "moduleGraph";
58 }
59
60 @Override
61 public String toString(List<? extends DocTree> tags, Element element) {
62 if (!enableModuleGraph) {
63 return "";
64 }
65
66 String moduleName = ((ModuleElement) element).getQualifiedName().toString();
67 String imageFile = moduleName + "-graph.png";
68 int thumbnailHeight = -1;
69 String hoverImage = "";
70 if (!moduleName.equals("java.base")) {
71 thumbnailHeight = 100; // also appears in the stylesheet
72 hoverImage = "<span>"
73 + getImage(moduleName, imageFile, -1, true)
74 + "</span>";
75 }
76 return "<dt>"
77 + "<span class=\"simpleTagLabel\">Module Graph:</span>\n"
78 + "</dt>"
79 + "<dd>"
80 + "<a class=moduleGraph href=\"" + imageFile + "\">"
81 + getImage(moduleName, imageFile, thumbnailHeight, false)
82 + hoverImage
83 + "</a>"
84 + "</dd>";
85 }
86
87 private static final String VERTICAL_ALIGN = "vertical-align:top";
88 private static final String BORDER = "border: solid lightgray 1px;";
89
90 private String getImage(String moduleName, String file, int height, boolean useBorder) {
91 return String.format("<img style=\"%s\" alt=\"Module graph for %s\" src=\"%s\"%s>",
92 useBorder ? BORDER + " " + VERTICAL_ALIGN : VERTICAL_ALIGN,
93 moduleName,
94 file,
95 (height <= 0 ? "" : " height=\"" + height + "\""));
96 }
97 }
|
47 return EnumSet.of(MODULE);
48 }
49
50 @Override
51 public boolean isInlineTag() {
52 return false;
53 }
54
55 @Override
56 public String getName() {
57 return "moduleGraph";
58 }
59
60 @Override
61 public String toString(List<? extends DocTree> tags, Element element) {
62 if (!enableModuleGraph) {
63 return "";
64 }
65
66 String moduleName = ((ModuleElement) element).getQualifiedName().toString();
67 String imageFile = moduleName + "/module-graph.png";
68 int thumbnailHeight = -1;
69 String hoverImage = "";
70 if (!moduleName.equals("java.base")) {
71 thumbnailHeight = 100; // also appears in the stylesheet
72 hoverImage = "<span>"
73 + getImage(moduleName, imageFile, -1, true)
74 + "</span>";
75 }
76 return "<dt>"
77 + "<span class=\"simpleTagLabel\">Module Graph:</span>\n"
78 + "</dt>"
79 + "<dd>"
80 + "<a class=moduleGraph href=\"" + imageFile + "\">"
81 + getImage(moduleName, imageFile, thumbnailHeight, false)
82 + hoverImage
83 + "</a>"
84 + "</dd>";
85 }
86
87 private static final String VERTICAL_ALIGN = "vertical-align:top";
88 private static final String BORDER = "border: solid lightgray 1px;";
89
90 private String getImage(String moduleName, String file, int height, boolean useBorder) {
91 return String.format("<img style=\"%s\" alt=\"Module graph for %s\" src=\"%s\"%s>",
92 useBorder ? BORDER + " " + VERTICAL_ALIGN : VERTICAL_ALIGN,
93 moduleName,
94 file,
95 (height <= 0 ? "" : " height=\"" + height + "\""));
96 }
97 }
|