< prev index next >

src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/LinkFactoryImpl.java

Print this page

        

*** 33,44 **** import javax.lang.model.type.TypeMirror; import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration; import jdk.javadoc.internal.doclets.toolkit.Content; import jdk.javadoc.internal.doclets.toolkit.util.DocPath; ! import jdk.javadoc.internal.doclets.toolkit.util.Utils; import jdk.javadoc.internal.doclets.toolkit.util.links.LinkFactory; import jdk.javadoc.internal.doclets.toolkit.util.links.LinkInfo; /** * A factory that returns a link given the information about it. --- 33,45 ---- import javax.lang.model.type.TypeMirror; import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration; import jdk.javadoc.internal.doclets.toolkit.Content; + import jdk.javadoc.internal.doclets.toolkit.Resources; import jdk.javadoc.internal.doclets.toolkit.util.DocPath; ! import jdk.javadoc.internal.doclets.toolkit.util.DocPaths; import jdk.javadoc.internal.doclets.toolkit.util.links.LinkFactory; import jdk.javadoc.internal.doclets.toolkit.util.links.LinkInfo; /** * A factory that returns a link given the information about it.
*** 51,63 **** --- 52,67 ---- * @author Jamie Ho */ public class LinkFactoryImpl extends LinkFactory { private final HtmlDocletWriter m_writer; + private final DocPaths docPaths; public LinkFactoryImpl(HtmlDocletWriter writer) { + super(writer.configuration.utils); m_writer = writer; + docPaths = writer.configuration.docPaths; } /** * {@inheritDoc} */
*** 70,80 **** * {@inheritDoc} */ @Override protected Content getClassLink(LinkInfo linkInfo) { BaseConfiguration configuration = m_writer.configuration; - Utils utils = configuration.utils; LinkInfoImpl classLinkInfo = (LinkInfoImpl) linkInfo; boolean noLabel = linkInfo.label == null || linkInfo.label.isEmpty(); TypeElement typeElement = classLinkInfo.typeElement; // Create a tool tip if we are linking to a class or interface. Don't // create one if we are linking to a member. --- 74,83 ----
*** 82,99 **** if (classLinkInfo.where == null || classLinkInfo.where.length() == 0) { boolean isTypeLink = classLinkInfo.type != null && utils.isTypeVariable(utils.getComponentType(classLinkInfo.type)); title = getClassToolTip(typeElement, isTypeLink); } ! Content label = classLinkInfo.getClassLinkLabel(m_writer.configuration); Content link = new ContentBuilder(); if (utils.isIncluded(typeElement)) { if (configuration.isGeneratedDoc(typeElement)) { DocPath filename = getPath(classLinkInfo); if (linkInfo.linkToSelf || ! !(DocPath.forName(utils, typeElement)).equals(m_writer.filename)) { link.addContent(m_writer.links.createLink( filename.fragment(classLinkInfo.where), label, classLinkInfo.isStrong, title, --- 85,102 ---- if (classLinkInfo.where == null || classLinkInfo.where.length() == 0) { boolean isTypeLink = classLinkInfo.type != null && utils.isTypeVariable(utils.getComponentType(classLinkInfo.type)); title = getClassToolTip(typeElement, isTypeLink); } ! Content label = classLinkInfo.getClassLinkLabel(configuration); Content link = new ContentBuilder(); if (utils.isIncluded(typeElement)) { if (configuration.isGeneratedDoc(typeElement)) { DocPath filename = getPath(classLinkInfo); if (linkInfo.linkToSelf || ! !(docPaths.forName(typeElement)).equals(m_writer.filename)) { link.addContent(m_writer.links.createLink( filename.fragment(classLinkInfo.where), label, classLinkInfo.isStrong, title,
*** 138,148 **** return getLink(typeLinkInfo); } @Override public Content getTypeAnnotationLinks(LinkInfo linkInfo) { - Utils utils = ((LinkInfoImpl)linkInfo).utils; ContentBuilder links = new ContentBuilder(); List<? extends AnnotationMirror> annotations; if (utils.isAnnotated(linkInfo.type)) { annotations = linkInfo.type.getAnnotationMirrors(); } else if (utils.isTypeVariable(linkInfo.type)) { --- 141,150 ----
*** 189,214 **** * * @param typeElement the class to get the tool tip for. * @return the tool tip for the appropriate class. */ private String getClassToolTip(TypeElement typeElement, boolean isTypeLink) { ! BaseConfiguration configuration = m_writer.configuration; ! Utils utils = configuration.utils; if (isTypeLink) { ! return configuration.getText("doclet.Href_Type_Param_Title", utils.getSimpleName(typeElement)); } else if (utils.isInterface(typeElement)){ ! return configuration.getText("doclet.Href_Interface_Title", utils.getPackageName(utils.containingPackage(typeElement))); } else if (utils.isAnnotationType(typeElement)) { ! return configuration.getText("doclet.Href_Annotation_Title", utils.getPackageName(utils.containingPackage(typeElement))); } else if (utils.isEnum(typeElement)) { ! return configuration.getText("doclet.Href_Enum_Title", utils.getPackageName(utils.containingPackage(typeElement))); } else { ! return configuration.getText("doclet.Href_Class_Title", utils.getPackageName(utils.containingPackage(typeElement))); } } /** --- 191,215 ---- * * @param typeElement the class to get the tool tip for. * @return the tool tip for the appropriate class. */ private String getClassToolTip(TypeElement typeElement, boolean isTypeLink) { ! Resources resources = m_writer.configuration.getResources(); if (isTypeLink) { ! return resources.getText("doclet.Href_Type_Param_Title", utils.getSimpleName(typeElement)); } else if (utils.isInterface(typeElement)){ ! return resources.getText("doclet.Href_Interface_Title", utils.getPackageName(utils.containingPackage(typeElement))); } else if (utils.isAnnotationType(typeElement)) { ! return resources.getText("doclet.Href_Annotation_Title", utils.getPackageName(utils.containingPackage(typeElement))); } else if (utils.isEnum(typeElement)) { ! return resources.getText("doclet.Href_Enum_Title", utils.getPackageName(utils.containingPackage(typeElement))); } else { ! return resources.getText("doclet.Href_Class_Title", utils.getPackageName(utils.containingPackage(typeElement))); } } /**
*** 221,230 **** */ private DocPath getPath(LinkInfoImpl linkInfo) { if (linkInfo.context == LinkInfoImpl.Kind.PACKAGE_FRAME) { //Not really necessary to do this but we want to be consistent //with 1.4.2 output. ! return DocPath.forName(linkInfo.utils, linkInfo.typeElement); } ! return m_writer.pathToRoot.resolve(DocPath.forClass(linkInfo.utils, linkInfo.typeElement)); } } --- 222,231 ---- */ private DocPath getPath(LinkInfoImpl linkInfo) { if (linkInfo.context == LinkInfoImpl.Kind.PACKAGE_FRAME) { //Not really necessary to do this but we want to be consistent //with 1.4.2 output. ! return docPaths.forName(linkInfo.typeElement); } ! return m_writer.pathToRoot.resolve(docPaths.forClass(linkInfo.typeElement)); } }
< prev index next >