src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Links.java
changeset 48295 c79d31ba84b9
parent 47851 6a9bb4f77d50
child 48654 36f58bd6269f
equal deleted inserted replaced
48294:2608240fc957 48295:c79d31ba84b9
   257      * @param target    the target for the link, or null
   257      * @param target    the target for the link, or null
   258      * @return a content tree for the link
   258      * @return a content tree for the link
   259      */
   259      */
   260     public static Content createLink(DocLink link, Content label, boolean strong,
   260     public static Content createLink(DocLink link, Content label, boolean strong,
   261             String title, String target) {
   261             String title, String target) {
       
   262         return createLink(link, label, strong, title, target, false);
       
   263     }
       
   264 
       
   265     /**
       
   266      * Creates a link of the form {@code <a href="link" title="title" target="target">label</a>}.
       
   267      * If {@code strong} is set, the label will be wrapped in
       
   268      *      {@code <span style="typeNameLink">...</span>}.
       
   269      *
       
   270      * @param link       the details for the link
       
   271      * @param label      the content for the link
       
   272      * @param strong     whether to wrap the {@code label} in a SPAN element
       
   273      * @param title      the title for the link
       
   274      * @param target     the target for the link, or null
       
   275      * @param isExternal is the link external to the generated documentation
       
   276      * @return a content tree for the link
       
   277      */
       
   278     public static Content createLink(DocLink link, Content label, boolean strong,
       
   279             String title, String target, boolean isExternal) {
   262         Content body = label;
   280         Content body = label;
   263         if (strong) {
   281         if (strong) {
   264             body = HtmlTree.SPAN(HtmlStyle.typeNameLink, body);
   282             body = HtmlTree.SPAN(HtmlStyle.typeNameLink, body);
   265         }
   283         }
   266         HtmlTree l = HtmlTree.A(link.toString(), body);
   284         HtmlTree l = HtmlTree.A(link.toString(), body);
   268             l.addAttr(HtmlAttr.TITLE, title);
   286             l.addAttr(HtmlAttr.TITLE, title);
   269         }
   287         }
   270         if (target != null && target.length() != 0) {
   288         if (target != null && target.length() != 0) {
   271             l.addAttr(HtmlAttr.TARGET, target);
   289             l.addAttr(HtmlAttr.TARGET, target);
   272         }
   290         }
       
   291         if (isExternal) {
       
   292             l.setStyle(HtmlStyle.externalLink);
       
   293         }
   273         return l;
   294         return l;
       
   295     }
       
   296 
       
   297     /**
       
   298      * Creates a link.
       
   299      *
       
   300      * @param link       the details for the link
       
   301      * @param label      the content for the link
       
   302      * @param isExternal is the link external to the generated documentation
       
   303      * @return a content tree for the link
       
   304      */
       
   305     public static Content createLink(DocLink link, Content label, boolean isExternal) {
       
   306         HtmlTree anchor = HtmlTree.A(link.toString(), label);
       
   307         anchor.setStyle(HtmlStyle.externalLink);
       
   308         return anchor;
   274     }
   309     }
   275 
   310 
   276 
   311 
   277     /**
   312     /**
   278      * Converts a name to a valid HTML name (id).
   313      * Converts a name to a valid HTML name (id).