langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java
changeset 21008 af0b915df7cc
parent 17563 e8ddeb9bd17c
child 21478 fa4c7cda1b41
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java	Thu Oct 10 08:51:55 2013 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java	Thu Oct 10 10:51:15 2013 -0700
@@ -89,10 +89,11 @@
      * @param memberlist List of members for the unicode character
      * @param contentTree the content tree to which the information will be added
      */
-    protected void addContents(Character unicode, List<? extends Doc> memberlist,
+    protected void addContents(Character uc, List<? extends Doc> memberlist,
             Content contentTree) {
-        contentTree.addContent(getMarkerAnchor("_" + unicode + "_"));
-        Content headContent = new StringContent(unicode.toString());
+        String unicode = uc.toString();
+        contentTree.addContent(getMarkerAnchorForIndex(unicode));
+        Content headContent = new StringContent(unicode);
         Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, false,
                 HtmlStyle.title, headContent);
         contentTree.addContent(heading);
@@ -253,4 +254,24 @@
         addPreQualifiedClassLink(LinkInfoImpl.Kind.INDEX, containing,
                 false, contentTree);
     }
+
+    /**
+     * Get the marker anchor which will be added to the index documentation tree.
+     *
+     * @param anchorNameForIndex the anchor name attribute for index page
+     * @return a content tree for the marker anchor
+     */
+    public Content getMarkerAnchorForIndex(String anchorNameForIndex) {
+        return getMarkerAnchor(getNameForIndex(anchorNameForIndex), null);
+    }
+
+    /**
+     * Generate a valid HTML name for member index page.
+     *
+     * @param unicode the string that needs to be converted to valid HTML name.
+     * @return a valid HTML name string.
+     */
+    public String getNameForIndex(String unicode) {
+        return "I:" + getName(unicode);
+    }
 }