Blog




The taglets library provides a couple of Javadoc tags that are rendered as an eye catcher in Javadoc API reports.

With JDK 1.7 the CSS styles for the generated API report have changed. Since the taglets library provides its own stylesheet and this stylesheet is based on Javadoc report structures prior to 1.7, the generation is now broken: The rendering is missing the correct stylesheet to layout propertly. Unfortunately there is no current release of the taglets library that fixes this issue.

But the workaround is quite easy. The taglets library relies on the following styles:

dt.tagletsTodo, dt.tagletsImpl , dt.tagletsEquivalence , dt.tagletsNote ,
dt.tagletsInfo, dt.tagletsDone , dt.tagletsWarning , dt.tagletsError {
  background-repeat: no-repeat;
  background-position: 0 center;
  padding-left: 19px;
  font-weight: bold;
}
 
dt.tagletsTodo b {
  background: #ff9 ;
  font-weight: bold;
}
 
dt.tagletsTodo {
  background-image: url(resources/icon_note_small.gif);
  margin-top: 1em ;
}
 
dd.tagletsTodo {
  margin-bottom: 1em;
}
 
dt.tagletsNote {
  background-image: url(resources/icon_note_small.gif);
}
 
dt.tagletsInfo {
  background-image: url(resources/icon_info_small.gif);
}
 
dt.tagletsDone {
  background-image: url(resources/icon_done_small.gif);
}
 
dt.tagletsWarning {
  background-image: url(resources/icon_warning_small.gif);
}
 
dt.tagletsError {
  background-image: url(resources/icon_error_small.gif);
}
 
dt.tagletsImpl {
  background-image: url(resources/icon_code_small.gif);
  margin-top: 1em ;
}
 
dd.tagletsImpl {
  margin-bottom: 1em;
}
 
dt.tagletsEquivalence {
  background-image: url(resources/icon_equivalence_small.gif);
}
 
dd.tagletsEquivalence {
  border-color: #888;
  border-style: dotted;
  border-width: 1px;
}
 
.tagletsEquivalence pre {
  padding: 0.33em ;
  margin: 0 ;
}
 
.tagletsTestCase pre {
  padding: 0 ;
  margin: 0 ;
}
 
.tagletsSource {
  border-color: #888;
  border-style: dotted;
  border-width: 1px;
  margin: .67em 0;
  padding: 0.33em ;
}
 
.tagletsSource p {
  margin-top: 0 ;
  margin-bottom: .33em;
}
 
.tagletsSource pre {
  margin: 0 ;
  padding: 0 ;
}
 
.tagletsStickyInfo, .tagletsStickyNote, .tagletsStickyWarning ,
.tagletsStickyError, .tagletsStickyDone, .tagletsExample {
  border-top: 5px solid #900;
  border-left: 1px solid #900 ;
  background-repeat: no-repeat;
  background-position: 5px 1.33em;
  background-color: #fff;
  margin: .67em 0;
  padding-left: 42px;
  min-height: 64px ;
}
 
.tagletsStickyInfo p, .tagletsStickyNote p, .tagletsStickyWarning p,
.tagletsStickyError p, .tagletsStickyDone p, .tagletsExample p {
  margin-top: .33em ;
  margin-bottom: .33em;
}
 
.tagletsExample {
  background-image: url(resources/icon_code_large.gif);
  border-color: #888;
}
 
.tagletsStickyNote {
  background-image: url(resources/icon_note_large.gif);
  border-color: #c1a040;
}
 
.tagletsStickyWarning {
  background-image: url(resources/icon_warning_large.gif);
  border-color: #c60;
}
 
.tagletsStickyError {
  background-image: url(resources/icon_error_large.gif);
  border-color: #900;
}
 
.tagletsStickyDone {
  background-image: url(resources/icon_done_large.gif);
  border-color: #090;
}
 
.tagletsStickyInfo {
  background-image: url(resources/icon_info_large.gif);
  border-color: #069;
}
 
table.section {
	border-width: 1px;
	border-spacing: 2px;
	border-style: outset;
	border-color: black;
	border-collapse: collapse;
}
 
table.section th {
	border-width: 1px;
	padding: 3px;
	border-style: inset;
	border-color: black;
}
 
table.section td {
	border-width: 1px;
	padding: 3px;
	border-style: inset;
	border-color: black;
}
 
table.doc {
	border: none;
}
 
.doc th {
	background: #bbb;
	border: none;
	text-align: left;
	vertical-align: top;
	padding-left: 4px;
	padding-right: 4px;
}
 
.doc td {
	border: none;
	border-width: 1px;
	vertical-align: top;
	padding-left: 4px;
	padding-right: 4px;
}
 
.doca td {
	background: #ddd;
	border: none;
	border-width: 1px;
	vertical-align: top;
	padding-left: 4px;
	padding-right: 4px;
}
 
.docb td {
	background: #efefef;
	border: none;
	border-width: 1px;
	vertical-align: top;
	padding-left: 4px;
	padding-right: 4px;
}
 
/* --- Pretty Printing Styles ----------------------------------------------- */
 
.str { color: #080; }
.kwd { color: #008; }
.com { color: #800; }
.typ { color: #606; }
.lit { color: #066; }
.pun { color: #660; }
.pln { color: #000; }
.tag { color: #008; }
.atn { color: #606; }
.atv { color: #080; }
.dec { color: #606; }
 
@media print {
  .str { color: #060; }
  .kwd { color: #006; font-weight: bold; }
  .com { color: #600; font-style: italic; }
  .typ { color: #404; font-weight: bold; }
  .lit { color: #044; }
  .pun { color: #440; }
  .pln { color: #000; }
  .tag { color: #006; font-weight: bold; }
  .atn { color: #404; }
  .atv { color: #060; }
}

If you add these styles to your stylesheet, the stylesheet can be integrated into your Maven build process like this:

<additionalJOption>
  -J-DTaglets.shutdown.javadoc-stylesheet-copy.files=${basedir}/src/etc/stylesheet.css
</additionalJOption>

Add this property to the configuration of the Maven Javadoc Plugin. Adjust the path to the stylesheet.css as is appropriate for your project.

To also activate Googles prettify.js, add the following configuration properies to your configuration (assumes that the prettify.js is in the specified location within the apidocs folder:

<header><![CDATA[<script src="{@docRoot}/resources/prettify.js" type="text/javascript"></script>]]></header>
<bottom><![CDATA[<script type="text/javascript">prettyPrint();</script>]]></bottom>
 

We have already blogged about how to integrate taglets in your Maven configuration. Please refer to Appealing API Documentation with taglet.

If you need Oracle's original CSS for the Javadoc report to start with, is is available at http://docs.oracle.com/javase/7/docs/api/stylesheet.css.


Link

Link

Posts