src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java

changeset 766
90af8d87741f
parent 554
9d9f26857129
child 798
4868a36f6fd8
equal deleted inserted replaced
758:bcbc86cc5b31 766:90af8d87741f
85 * @param label Tag for the link. 85 * @param label Tag for the link.
86 * @param strong Boolean that sets label to strong. 86 * @param strong Boolean that sets label to strong.
87 */ 87 */
88 public void printHyperLink(String link, String where, 88 public void printHyperLink(String link, String where,
89 String label, boolean strong) { 89 String label, boolean strong) {
90 print(getHyperLink(link, where, label, strong, "", "", "")); 90 print(getHyperLinkString(link, where, label, strong, "", "", ""));
91 } 91 }
92 92
93 /** 93 /**
94 * Print Html Hyper Link. 94 * Print Html Hyper Link.
95 * 95 *
113 * @param stylename String style of text defined in style sheet. 113 * @param stylename String style of text defined in style sheet.
114 */ 114 */
115 public void printHyperLink(String link, String where, 115 public void printHyperLink(String link, String where,
116 String label, boolean strong, 116 String label, boolean strong,
117 String stylename) { 117 String stylename) {
118 print(getHyperLink(link, where, label, strong, stylename, "", "")); 118 print(getHyperLinkString(link, where, label, strong, stylename, "", ""));
119 } 119 }
120 120
121 /** 121 /**
122 * Return Html Hyper Link string. 122 * Return Html Hyper Link string.
123 * 123 *
126 * needed. 126 * needed.
127 * @param label Tag for the link. 127 * @param label Tag for the link.
128 * @param strong Boolean that sets label to strong. 128 * @param strong Boolean that sets label to strong.
129 * @return String Hyper Link. 129 * @return String Hyper Link.
130 */ 130 */
131 public String getHyperLink(String link, String where, 131 public String getHyperLinkString(String link, String where,
132 String label, boolean strong) { 132 String label, boolean strong) {
133 return getHyperLink(link, where, label, strong, "", "", ""); 133 return getHyperLinkString(link, where, label, strong, "", "", "");
134 } 134 }
135 135
136 /** 136 /**
137 * Get Html Hyper Link string. 137 * Get Html Hyper Link string.
138 * 138 *
142 * @param label Tag for the link. 142 * @param label Tag for the link.
143 * @param strong Boolean that sets label to strong. 143 * @param strong Boolean that sets label to strong.
144 * @param stylename String style of text defined in style sheet. 144 * @param stylename String style of text defined in style sheet.
145 * @return String Hyper Link. 145 * @return String Hyper Link.
146 */ 146 */
147 public String getHyperLink(String link, String where, 147 public String getHyperLinkString(String link, String where,
148 String label, boolean strong, 148 String label, boolean strong,
149 String stylename) { 149 String stylename) {
150 return getHyperLink(link, where, label, strong, stylename, "", ""); 150 return getHyperLinkString(link, where, label, strong, stylename, "", "");
151 }
152
153 /**
154 * Get Html Hyper Link string.
155 *
156 * @param link String name of the file.
157 * @param where Position of the link in the file. Character '#' is not
158 * needed.
159 * @param label Tag for the link.
160 * @return a content tree for the hyper link
161 */
162 public Content getHyperLink(String link, String where,
163 Content label) {
164 return getHyperLink(link, where, label, "", "");
151 } 165 }
152 166
153 /** 167 /**
154 * Get Html Hyper Link string. 168 * Get Html Hyper Link string.
155 * 169 *
161 * @param stylename String style of text defined in style sheet. 175 * @param stylename String style of text defined in style sheet.
162 * @param title String that describes the link's content for accessibility. 176 * @param title String that describes the link's content for accessibility.
163 * @param target Target frame. 177 * @param target Target frame.
164 * @return String Hyper Link. 178 * @return String Hyper Link.
165 */ 179 */
166 public String getHyperLink(String link, String where, 180 public String getHyperLinkString(String link, String where,
167 String label, boolean strong, 181 String label, boolean strong,
168 String stylename, String title, String target) { 182 String stylename, String title, String target) {
169 StringBuffer retlink = new StringBuffer(); 183 StringBuffer retlink = new StringBuffer();
170 retlink.append("<A HREF=\""); 184 retlink.append("<a href=\"");
171 retlink.append(link); 185 retlink.append(link);
172 if (where != null && where.length() != 0) { 186 if (where != null && where.length() != 0) {
173 retlink.append("#"); 187 retlink.append("#");
174 retlink.append(where); 188 retlink.append(where);
175 } 189 }
185 retlink.append("<FONT CLASS=\""); 199 retlink.append("<FONT CLASS=\"");
186 retlink.append(stylename); 200 retlink.append(stylename);
187 retlink.append("\">"); 201 retlink.append("\">");
188 } 202 }
189 if (strong) { 203 if (strong) {
190 retlink.append("<STRONG>"); 204 retlink.append("<span class=\"strong\">");
191 } 205 }
192 retlink.append(label); 206 retlink.append(label);
193 if (strong) { 207 if (strong) {
194 retlink.append("</STRONG>"); 208 retlink.append("</span>");
195 } 209 }
196 if (stylename != null && stylename.length() != 0) { 210 if (stylename != null && stylename.length() != 0) {
197 retlink.append("</FONT>"); 211 retlink.append("</FONT>");
198 } 212 }
199 retlink.append("</A>"); 213 retlink.append("</a>");
200 return retlink.toString(); 214 return retlink.toString();
201 } 215 }
202 216
203 /** 217 /**
204 * Print link without positioning in the file. 218 * Get Html Hyper Link.
205 * 219 *
206 * @param link String name of the file. 220 * @param link String name of the file.
207 * @param label Tag for the link. 221 * @param where Position of the link in the file. Character '#' is not
208 */ 222 * needed.
209 public void printHyperLink(String link, String label) { 223 * @param label Tag for the link.
210 print(getHyperLink(link, "", label, false)); 224 * @param title String that describes the link's content for accessibility.
225 * @param target Target frame.
226 * @return a content tree for the hyper link.
227 */
228 public Content getHyperLink(String link, String where,
229 Content label, String title, String target) {
230 if (where != null && where.length() != 0) {
231 link += "#" + where;
232 }
233 HtmlTree anchor = HtmlTree.A(link, label);
234 if (title != null && title.length() != 0) {
235 anchor.addAttr(HtmlAttr.TITLE, title);
236 }
237 if (target != null && target.length() != 0) {
238 anchor.addAttr(HtmlAttr.TARGET, target);
239 }
240 return anchor;
241 }
242
243 /**
244 * Get a hyperlink to a file.
245 *
246 * @param link String name of the file
247 * @param label Label for the link
248 * @return a content for the hyperlink to the file
249 */
250 public Content getHyperLink(String link, Content label) {
251 return getHyperLink(link, "", label);
211 } 252 }
212 253
213 /** 254 /**
214 * Get link string without positioning in the file. 255 * Get link string without positioning in the file.
215 * 256 *
216 * @param link String name of the file. 257 * @param link String name of the file.
217 * @param label Tag for the link. 258 * @param label Tag for the link.
218 * @return Strign Hyper link. 259 * @return Strign Hyper link.
219 */ 260 */
220 public String getHyperLink(String link, String label) { 261 public String getHyperLinkString(String link, String label) {
221 return getHyperLink(link, "", label, false); 262 return getHyperLinkString(link, "", label, false);
222 } 263 }
223 264
224 /** 265 /**
225 * Print the name of the package, this class is in. 266 * Print the name of the package, this class is in.
226 * 267 *
271 312
272 /** 313 /**
273 * Print the frameset version of the Html file header. 314 * Print the frameset version of the Html file header.
274 * Called only when generating an HTML frameset file. 315 * Called only when generating an HTML frameset file.
275 * 316 *
276 * @param title Title of this HTML document. 317 * @param title Title of this HTML document
277 */ 318 * @param noTimeStamp If true, don't print time stamp in header
278 public void printFramesetHeader(String title) { 319 * @param frameset the frameset to be added to the HTML document
279 printFramesetHeader(title, false); 320 */
280 } 321 public void printFramesetDocument(String title, boolean noTimeStamp,
281 322 Content frameset) {
282 /** 323 Content htmlDocType = DocType.Frameset();
283 * Print the frameset version of the Html file header. 324 Content htmlComment = new Comment(configuration.getText("doclet.New_Page"));
284 * Called only when generating an HTML frameset file. 325 Content head = new HtmlTree(HtmlTag.HEAD);
285 *
286 * @param title Title of this HTML document.
287 * @param noTimeStamp If true, don't print time stamp in header.
288 */
289 public void printFramesetHeader(String title, boolean noTimeStamp) {
290 println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 " +
291 "Frameset//EN\" " +
292 "\"http://www.w3.org/TR/html4/frameset.dtd\">");
293 println("<!--NewPage-->");
294 html();
295 head();
296 if (! noTimeStamp) { 326 if (! noTimeStamp) {
297 print("<!-- Generated by javadoc on "); 327 Content headComment = new Comment("Generated by javadoc on " + today());
298 print(today()); 328 head.addContent(headComment);
299 println("-->");
300 } 329 }
301 if (configuration.charset.length() > 0) { 330 if (configuration.charset.length() > 0) {
302 println("<META http-equiv=\"Content-Type\" content=\"text/html; " 331 Content meta = HtmlTree.META("Content-Type", "text/html",
303 + "charset=" + configuration.charset + "\">"); 332 configuration.charset);
304 } 333 head.addContent(meta);
305 title(); 334 }
306 println(title); 335 Content windowTitle = HtmlTree.TITLE(new StringContent(title));
307 titleEnd(); 336 head.addContent(windowTitle);
308 //Script to set the classFrame if necessary. 337 head.addContent(getFramesetJavaScript());
309 script(); 338 Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(),
310 println(" targetPage = \"\" + window.location.search;"); 339 head, frameset);
311 println(" if (targetPage != \"\" && targetPage != \"undefined\")"); 340 Content htmlDocument = new HtmlDocument(htmlDocType,
312 println(" targetPage = targetPage.substring(1);"); 341 htmlComment, htmlTree);
313 println(" if (targetPage.indexOf(\":\") != -1)"); 342 print(htmlDocument.toString());
314 println(" targetPage = \"undefined\";");
315
316 println(" function loadFrames() {");
317 println(" if (targetPage != \"\" && targetPage != \"undefined\")");
318 println(" top.classFrame.location = top.targetPage;");
319 println(" }");
320 scriptEnd();
321 noScript();
322 noScriptEnd();
323 headEnd();
324 } 343 }
325 344
326 /** 345 /**
327 * Print the appropriate spaces to format the class tree in the class page. 346 * Print the appropriate spaces to format the class tree in the class page.
328 * 347 *

mercurial