75 ""; |
77 ""; |
76 StringBuilder label = new StringBuilder( |
78 StringBuilder label = new StringBuilder( |
77 classLinkInfo.getClassLinkLabel(m_writer.configuration)); |
79 classLinkInfo.getClassLinkLabel(m_writer.configuration)); |
78 classLinkInfo.displayLength += label.length(); |
80 classLinkInfo.displayLength += label.length(); |
79 Configuration configuration = m_writer.configuration; |
81 Configuration configuration = m_writer.configuration; |
80 LinkOutputImpl linkOutput = new LinkOutputImpl(); |
82 Content link = new ContentBuilder(); |
81 if (classDoc.isIncluded()) { |
83 if (classDoc.isIncluded()) { |
82 if (configuration.isGeneratedDoc(classDoc)) { |
84 if (configuration.isGeneratedDoc(classDoc)) { |
83 DocPath filename = getPath(classLinkInfo); |
85 DocPath filename = getPath(classLinkInfo); |
84 if (linkInfo.linkToSelf || |
86 if (linkInfo.linkToSelf || |
85 !(DocPath.forName(classDoc)).equals(m_writer.filename)) { |
87 !(DocPath.forName(classDoc)).equals(m_writer.filename)) { |
86 linkOutput.append(m_writer.getHyperLinkString( |
88 link.addContent(new RawHtml(m_writer.getHyperLinkString( |
87 filename.fragment(classLinkInfo.where), |
89 filename.fragment(classLinkInfo.where), |
88 label.toString(), |
90 label.toString(), |
89 classLinkInfo.isStrong, classLinkInfo.styleName, |
91 classLinkInfo.isStrong, classLinkInfo.styleName, |
90 title, classLinkInfo.target)); |
92 title, classLinkInfo.target))); |
91 if (noLabel && !classLinkInfo.excludeTypeParameterLinks) { |
93 if (noLabel && !classLinkInfo.excludeTypeParameterLinks) { |
92 linkOutput.append(getTypeParameterLinks(linkInfo).toString()); |
94 link.addContent(getTypeParameterLinks(linkInfo)); |
93 } |
95 } |
94 return linkOutput; |
96 return link; |
95 } |
97 } |
96 } |
98 } |
97 } else { |
99 } else { |
98 String crossLink = m_writer.getCrossClassLink( |
100 String crossLink = m_writer.getCrossClassLink( |
99 classDoc.qualifiedName(), classLinkInfo.where, |
101 classDoc.qualifiedName(), classLinkInfo.where, |
100 label.toString(), classLinkInfo.isStrong, classLinkInfo.styleName, |
102 label.toString(), classLinkInfo.isStrong, classLinkInfo.styleName, |
101 true); |
103 true); |
102 if (crossLink != null) { |
104 if (crossLink != null) { |
103 linkOutput.append(crossLink); |
105 link.addContent(new RawHtml(crossLink)); |
104 if (noLabel && !classLinkInfo.excludeTypeParameterLinks) { |
106 if (noLabel && !classLinkInfo.excludeTypeParameterLinks) { |
105 linkOutput.append(getTypeParameterLinks(linkInfo).toString()); |
107 link.addContent(getTypeParameterLinks(linkInfo)); |
106 } |
108 } |
107 return linkOutput; |
109 return link; |
108 } |
110 } |
109 } |
111 } |
110 // Can't link so just write label. |
112 // Can't link so just write label. |
111 linkOutput.append(label.toString()); |
113 link.addContent(new RawHtml(label.toString())); |
112 if (noLabel && !classLinkInfo.excludeTypeParameterLinks) { |
114 if (noLabel && !classLinkInfo.excludeTypeParameterLinks) { |
113 linkOutput.append(getTypeParameterLinks(linkInfo).toString()); |
115 link.addContent(getTypeParameterLinks(linkInfo)); |
114 } |
116 } |
115 return linkOutput; |
117 return link; |
116 } |
118 } |
117 |
119 |
118 /** |
120 /** |
119 * {@inheritDoc} |
121 * {@inheritDoc} |
120 */ |
122 */ |
121 protected LinkOutput getTypeParameterLink(LinkInfo linkInfo, |
123 protected Content getTypeParameterLink(LinkInfo linkInfo, |
122 Type typeParam) { |
124 Type typeParam) { |
123 LinkInfoImpl typeLinkInfo = new LinkInfoImpl(m_writer.configuration, |
125 LinkInfoImpl typeLinkInfo = new LinkInfoImpl(m_writer.configuration, |
124 ((LinkInfoImpl) linkInfo).getContext(), typeParam); |
126 ((LinkInfoImpl) linkInfo).getContext(), typeParam); |
125 typeLinkInfo.excludeTypeBounds = linkInfo.excludeTypeBounds; |
127 typeLinkInfo.excludeTypeBounds = linkInfo.excludeTypeBounds; |
126 typeLinkInfo.excludeTypeParameterLinks = linkInfo.excludeTypeParameterLinks; |
128 typeLinkInfo.excludeTypeParameterLinks = linkInfo.excludeTypeParameterLinks; |
127 typeLinkInfo.linkToSelf = linkInfo.linkToSelf; |
129 typeLinkInfo.linkToSelf = linkInfo.linkToSelf; |
128 typeLinkInfo.isJava5DeclarationLocation = false; |
130 typeLinkInfo.isJava5DeclarationLocation = false; |
129 LinkOutput output = getLinkOutput(typeLinkInfo); |
131 Content output = getLink(typeLinkInfo); |
130 ((LinkInfoImpl) linkInfo).displayLength += typeLinkInfo.displayLength; |
132 ((LinkInfoImpl) linkInfo).displayLength += typeLinkInfo.displayLength; |
131 return output; |
133 return output; |
132 } |
134 } |
133 |
135 |
134 protected LinkOutput getTypeAnnotationLink(LinkInfo linkInfo, |
136 protected Content getTypeAnnotationLink(LinkInfo linkInfo, |
135 AnnotationDesc annotation) { |
137 AnnotationDesc annotation) { |
136 throw new RuntimeException("Not implemented yet!"); |
138 throw new RuntimeException("Not implemented yet!"); |
137 } |
139 } |
138 |
140 |
139 public LinkOutput getTypeAnnotationLinks(LinkInfo linkInfo) { |
141 public Content getTypeAnnotationLinks(LinkInfo linkInfo) { |
140 LinkOutput output = getOutputInstance(); |
142 ContentBuilder links = new ContentBuilder(); |
141 AnnotationDesc[] annotations; |
143 AnnotationDesc[] annotations; |
142 if (linkInfo.type instanceof AnnotatedType) { |
144 if (linkInfo.type instanceof AnnotatedType) { |
143 annotations = linkInfo.type.asAnnotatedType().annotations(); |
145 annotations = linkInfo.type.asAnnotatedType().annotations(); |
144 } else if (linkInfo.type instanceof TypeVariable) { |
146 } else if (linkInfo.type instanceof TypeVariable) { |
145 annotations = linkInfo.type.asTypeVariable().annotations(); |
147 annotations = linkInfo.type.asTypeVariable().annotations(); |
146 } else { |
148 } else { |
147 return output; |
149 return links; |
148 } |
150 } |
149 |
151 |
150 if (annotations.length == 0) |
152 if (annotations.length == 0) |
151 return output; |
153 return links; |
152 |
154 |
153 List<String> annos = m_writer.getAnnotations(0, annotations, false, linkInfo.isJava5DeclarationLocation); |
155 List<String> annos = m_writer.getAnnotations(0, annotations, false, linkInfo.isJava5DeclarationLocation); |
154 |
156 |
155 boolean isFirst = true; |
157 boolean isFirst = true; |
156 for (String anno : annos) { |
158 for (String anno : annos) { |
157 if (!isFirst) { |
159 if (!isFirst) { |
158 linkInfo.displayLength += 1; |
160 linkInfo.displayLength += 1; |
159 output.append(" "); |
161 links.addContent(" "); |
160 } |
162 } |
161 output.append(anno); |
163 links.addContent(new RawHtml(anno)); |
162 isFirst = false; |
164 isFirst = false; |
163 } |
165 } |
164 if (!annos.isEmpty()) { |
166 if (!annos.isEmpty()) { |
165 linkInfo.displayLength += 1; |
167 linkInfo.displayLength += 1; |
166 output.append(" "); |
168 links.addContent(" "); |
167 } |
169 } |
168 |
170 |
169 return output; |
171 return links; |
170 } |
172 } |
171 |
173 |
172 /** |
174 /** |
173 * Given a class, return the appropriate tool tip. |
175 * Given a class, return the appropriate tool tip. |
174 * |
176 * |
180 if (isTypeLink) { |
182 if (isTypeLink) { |
181 return configuration.getText("doclet.Href_Type_Param_Title", |
183 return configuration.getText("doclet.Href_Type_Param_Title", |
182 classDoc.name()); |
184 classDoc.name()); |
183 } else if (classDoc.isInterface()){ |
185 } else if (classDoc.isInterface()){ |
184 return configuration.getText("doclet.Href_Interface_Title", |
186 return configuration.getText("doclet.Href_Interface_Title", |
185 Util.getPackageName(classDoc.containingPackage())); |
187 Util.escapeHtmlChars(Util.getPackageName(classDoc.containingPackage()))); |
186 } else if (classDoc.isAnnotationType()) { |
188 } else if (classDoc.isAnnotationType()) { |
187 return configuration.getText("doclet.Href_Annotation_Title", |
189 return configuration.getText("doclet.Href_Annotation_Title", |
188 Util.getPackageName(classDoc.containingPackage())); |
190 Util.escapeHtmlChars(Util.getPackageName(classDoc.containingPackage()))); |
189 } else if (classDoc.isEnum()) { |
191 } else if (classDoc.isEnum()) { |
190 return configuration.getText("doclet.Href_Enum_Title", |
192 return configuration.getText("doclet.Href_Enum_Title", |
191 Util.getPackageName(classDoc.containingPackage())); |
193 Util.escapeHtmlChars(Util.getPackageName(classDoc.containingPackage()))); |
192 } else { |
194 } else { |
193 return configuration.getText("doclet.Href_Class_Title", |
195 return configuration.getText("doclet.Href_Class_Title", |
194 Util.getPackageName(classDoc.containingPackage())); |
196 Util.escapeHtmlChars(Util.getPackageName(classDoc.containingPackage()))); |
195 } |
197 } |
196 } |
198 } |
197 |
199 |
198 /** |
200 /** |
199 * Return path to the given file name in the given package. So if the name |
201 * Return path to the given file name in the given package. So if the name |