Java Reference
In-Depth Information
Composite listFormatting
#
new
Font("
!
2", infoColor,
"Courier New");
Ul list
#
new
Ul();
listFormatting.addChild(list);
body.addChild(listFormatting);
membersPlaceholder
#
list;
// add a small embellishment: a link to Java homepage at
// Sun
Composite link
#
new
Link("http://java.sun.com");
link.addChild(
new
Text("Java © Sun"));
body.addChild(link);
}
// handle the name of the class by filling in the title
// of the HTML page and the heading at the top of the page
private void
gotClassName(String className) {
titlePlaceholder.addChild(
new
Text(className));
head
#
new
Head("Class: "
!
className);
}
// handle a public member: put the member inside a LI
// element, then add this element in the placeholder for
// the public elements
private void
gotMember(String member) {
// creates a new LI item
Li item
#
new
Li();
// add the last chunk to the list item
item.addChild(
new
Text(member));
// putting a line break at the end
item.addChild(new Br());
// add the item to the placeholder
membersPlaceholder.addChild(item);
}
// compose the components into a single page at the end
// of the parsing
private void
composePage() {
page
#
new
Page();
if
(head !
#
null
)
page.addChild(head);
page.addChild(body);
}
// receives the notification of parsing events and calls
// the appropriate helper method
public void
update(Observable observable, Object arg) {
JavaParseEvent event
#
(JavaParseEvent) arg;
if
(event.type
##
JavaParseEvent.BEGIN_PARSING)
setupFramework();