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

changeset 1833
f1b90ea7d402
parent 1829
c7c6bfe7fc1f
parent 1746
bd51ca92c013
child 1835
536cad596942
equal deleted inserted replaced
1832:7ee1fd365cdd 1833:f1b90ea7d402
25 25
26 package com.sun.tools.doclets.formats.html.markup; 26 package com.sun.tools.doclets.formats.html.markup;
27 27
28 import java.io.*; 28 import java.io.*;
29 import java.util.*; 29 import java.util.*;
30 import java.util.regex.Matcher;
31 import java.util.regex.Pattern;
30 32
31 import com.sun.tools.doclets.internal.toolkit.*; 33 import com.sun.tools.doclets.internal.toolkit.*;
32 import com.sun.tools.doclets.internal.toolkit.util.*; 34 import com.sun.tools.doclets.internal.toolkit.util.*;
33 35
34 /** 36 /**
193 configuration.getText("doclet.packages")); 195 configuration.getText("doclet.packages"));
194 modifierTypeHeader = configuration.getText("doclet.0_and_1", 196 modifierTypeHeader = configuration.getText("doclet.0_and_1",
195 configuration.getText("doclet.Modifier"), 197 configuration.getText("doclet.Modifier"),
196 configuration.getText("doclet.Type")); 198 configuration.getText("doclet.Type"));
197 overviewLabel = getResource("doclet.Overview"); 199 overviewLabel = getResource("doclet.Overview");
198 defaultPackageLabel = new RawHtml( 200 defaultPackageLabel = new StringContent(DocletConstants.DEFAULT_PACKAGE_NAME);
199 DocletConstants.DEFAULT_PACKAGE_NAME);
200 packageLabel = getResource("doclet.Package"); 201 packageLabel = getResource("doclet.Package");
201 profileLabel = getResource("doclet.Profile"); 202 profileLabel = getResource("doclet.Profile");
202 useLabel = getResource("doclet.navClassUse"); 203 useLabel = getResource("doclet.navClassUse");
203 prevLabel = getResource("doclet.Prev"); 204 prevLabel = getResource("doclet.Prev");
204 nextLabel = getResource("doclet.Next"); 205 nextLabel = getResource("doclet.Next");
250 * 251 *
251 * @param key the key to look for in the configuration file 252 * @param key the key to look for in the configuration file
252 * @return a content tree for the text 253 * @return a content tree for the text
253 */ 254 */
254 public Content getResource(String key) { 255 public Content getResource(String key) {
255 return new StringContent(configuration.getText(key)); 256 return configuration.getResource(key);
256 } 257 }
257 258
258 /** 259 /**
259 * Get the configuration string as a content. 260 * Get the configuration string as a content.
260 * 261 *
261 * @param key the key to look for in the configuration file 262 * @param key the key to look for in the configuration file
262 * @param a1 string argument added to configuration text 263 * @param o string or content argument added to configuration text
263 * @return a content tree for the text 264 * @return a content tree for the text
264 */ 265 */
265 public Content getResource(String key, String a1) { 266 public Content getResource(String key, Object o) {
266 return new RawHtml(configuration.getText(key, a1)); 267 return configuration.getResource(key, o);
267 } 268 }
268 269
269 /** 270 /**
270 * Get the configuration string as a content. 271 * Get the configuration string as a content.
271 * 272 *
272 * @param key the key to look for in the configuration file 273 * @param key the key to look for in the configuration file
273 * @param a1 string argument added to configuration text 274 * @param o1 string or content argument added to configuration text
274 * @param a2 string argument added to configuration text 275 * @param o2 string or content argument added to configuration text
275 * @return a content tree for the text 276 * @return a content tree for the text
276 */ 277 */
277 public Content getResource(String key, String a1, String a2) { 278 public Content getResource(String key, Object o0, Object o1) {
278 return new RawHtml(configuration.getText(key, a1, a2)); 279 return configuration.getResource(key, o0, o1);
279 } 280 }
280 281
281 /** 282 /**
282 * Returns an HtmlTree for the SCRIPT tag. 283 * Returns an HtmlTree for the SCRIPT tag.
283 * 284 *
301 /** 302 /**
302 * Returns a content tree for the SCRIPT tag for the main page(index.html). 303 * Returns a content tree for the SCRIPT tag for the main page(index.html).
303 * 304 *
304 * @return a content for the SCRIPT tag 305 * @return a content for the SCRIPT tag
305 */ 306 */
306 protected Content getFramesetJavaScript(){ 307 protected Content getFramesetJavaScript() {
307 HtmlTree script = new HtmlTree(HtmlTag.SCRIPT); 308 HtmlTree script = new HtmlTree(HtmlTag.SCRIPT);
308 script.addAttr(HtmlAttr.TYPE, "text/javascript"); 309 script.addAttr(HtmlAttr.TYPE, "text/javascript");
309 String scriptCode = DocletConstants.NL + " targetPage = \"\" + window.location.search;" + DocletConstants.NL + 310 String scriptCode = DocletConstants.NL +
311 " targetPage = \"\" + window.location.search;" + DocletConstants.NL +
310 " if (targetPage != \"\" && targetPage != \"undefined\")" + DocletConstants.NL + 312 " if (targetPage != \"\" && targetPage != \"undefined\")" + DocletConstants.NL +
311 " targetPage = targetPage.substring(1);" + DocletConstants.NL + 313 " targetPage = targetPage.substring(1);" + DocletConstants.NL +
312 " if (targetPage.indexOf(\":\") != -1 || (targetPage != \"\" && !validURL(targetPage)))" + DocletConstants.NL + 314 " if (targetPage.indexOf(\":\") != -1 || (targetPage != \"\" && !validURL(targetPage)))" + DocletConstants.NL +
313 " targetPage = \"undefined\";" + DocletConstants.NL + 315 " targetPage = \"undefined\";" + DocletConstants.NL +
314 " function validURL(url) {" + DocletConstants.NL + 316 " function validURL(url) {" + DocletConstants.NL +
431 public HtmlTree getTitle() { 433 public HtmlTree getTitle() {
432 HtmlTree title = HtmlTree.TITLE(new StringContent(winTitle)); 434 HtmlTree title = HtmlTree.TITLE(new StringContent(winTitle));
433 return title; 435 return title;
434 } 436 }
435 437
436 /**
437 * Return, text passed, with Italics <i> and </i> tags, surrounding it.
438 * So if the text passed is "Hi", then string returned will be "<i>Hi</i>".
439 *
440 * @param text String to be printed in between <I> and </I> tags.
441 */
442 public String italicsText(String text) {
443 return "<i>" + text + "</i>";
444 }
445
446 public String codeText(String text) { 438 public String codeText(String text) {
447 return "<code>" + text + "</code>"; 439 return "<code>" + text + "</code>";
448 } 440 }
449 441
450 /** 442 /**

mercurial